/*
 * Already integrated:
USE SEARCHASTUDENTVIEW... Tapos dun sa viewAllInfo dun ilalabas ung list...
 * Add student, Add initial health condition, Add dmfx, Add Oral Health Services,Edit Student, Search Student
 * Yung sa addDMFX -> ausin pa ung dateofEXAM
*/
package test;
import javax.swing.JComboBox;
import javax.swing.JFormattedTextField;
import javax.swing.JOptionPane;
import javax.swing.JTabbedPane;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import java.awt.BorderLayout;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
import java.awt.Graphics.*;
import javax.swing.*;

import org.apache.torque.TorqueException;

import cesdentalrecord.dao.DmfxCond;
import cesdentalrecord.dao.InitialHealthCond;
import cesdentalrecord.dao.OralHealthService;
import cesdentalrecord.dao.Student;
import cesdentalrecord.dao.StudentPeer;
import cesdentalrecord.dao.ToothPeer;
import cesdentalrecord.dao.Total;
import cesdentalrecord.dao.TotalPeer;
import cesdentalrecord.dao.controller.ViewDMFXConditionController;
import cesdentalrecord.dao.controller.ViewInitialConditionController;
import cesdentalrecord.dao.controller.ViewOralHealthServicesController;
import cesdentalrecord.dao.view.AddDMFXConditionView;
import cesdentalrecord.dao.view.AddInitialConditionView;
import cesdentalrecord.dao.view.AddOralServicesView;
import cesdentalrecord.dao.view.AddStudentView;
import cesdentalrecord.dao.view.EditStudentView;
import cesdentalrecord.dao.view.SearchAStudentView;
import cesdentalrecord.dao.view.SearchView;
import cesdentalrecord.dao.view.ViewAStudentView;
import cesdentalrecord.dao.view.ViewAllStudentsView;

import java.awt.*;              //for layout managers and more
import java.awt.event.*;        //for action events
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class MyInterface extends JPanel implements ActionListener {
	Student s = new Student();
	Student dmfx = new Student();
	Student ohs = new Student();
	Student me = new Student();
	Boolean editchecker = false;
	Icon tooth01 = new ImageIcon(getClass().getResource("toothPix01.jpg"));
	Icon mainBG = new ImageIcon(getClass().getResource("mainBG.jpg"));
	Image semiBG = (new ImageIcon("semiBG.jpg")).getImage();
	
	int perm = 0;
	int soundpermanent = 0;
	int decayedpermanent = 0;
	int missingpermanent = 0;
	int filledpermanent = 0;
	
	int temp =0;
	int soundtemp = 0;
	int decayedtemp = 0;
	int missingtemp = 0;
	int filledtemp = 0;
	
	
    @SuppressWarnings("unchecked")
	public MyInterface () {
    	
    	
        super(new GridLayout(1, 1));
   
        JTabbedPane tabbedPane = new JTabbedPane();
        
        JPanel mainPage = new JPanel();
        JLabel mainLabel = new JLabel(mainBG);  
        mainPage.add(mainLabel);
        tabbedPane.addTab("Main Page", tooth01, mainPage,
        "Main Page");
        tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
        
        
/*---------------------------text-fields---------------------------------*/        
        final JTextField surnameTextField = new JTextField(20);
        final JTextField firstNameTextField = new JTextField(20);
        final JTextField midNameTextField = new JTextField(3);
        final JTextField ageTextField = new JTextField(3);
        final JTextField placeOfBirth = new JTextField(57);
        final JTextField address = new JTextField(59);
        final JTextField parent = new JTextField(55);
        final JTextField occupation = new JTextField(57);
        final JTextField medicalHistory = new JTextField(55);
        
        
        String sexSelect  [] = {"", "M", "F"};
        String sectionSelect  [] = {"","1", "2", "3", "4","5","6","7","8","9","10"};
        String gradeSelect  [] = {"","1", "2", "3", "4","5","6"};
        
      
        final JComboBox sexComboBox = new JComboBox(sexSelect);
        sexComboBox.setEditable(false);
        
        final JComboBox section = new JComboBox(sectionSelect);
        section.setEditable(false);
        
        final JComboBox grade = new JComboBox(gradeSelect);
        grade.setEditable(false);
      
        String monthSelect  [] = {"","Jan", "Feb", "Mar","Apr", "May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"};
        String daySelect  [] = {"","1", "2", "3", "4","5","6","7","8","9","10","11","12",
        						"13","14","15","16","17","18","19","20","21","22","23","24",
        						"25","26","27","28","29","30","31"};
        
        
        final JComboBox monthOfBirth = new JComboBox(monthSelect);
        monthOfBirth.setEditable(false);
        //gawing spinner
        final JComboBox dayOfBirth = new JComboBox(daySelect);
        dayOfBirth.setEditable(false);
        //gawing spinner
        final JTextField yearOfBirth = new JTextField(6);
        
        
   /*-----------------------------labels----------------------------------*/        
        JLabel surnameLabel = new JLabel("Surname : ");
        JLabel firstNameLabel = new JLabel("Firstname : ");
        JLabel midNameLabel = new JLabel("Middle Initial : ");
        JLabel ageLabel = new JLabel("Age : ");
        JLabel sexLabel = new JLabel("Sex : ");
        JLabel gradeLabel = new JLabel("Grade : ");
        JLabel sectionLabel = new JLabel("Section : ");
        JLabel dateOfBirthLabel = new JLabel("Date of Birth : ");
        JLabel monthOfBirthLabel = new JLabel("Month : ");
        JLabel dayOfBirthLabel = new JLabel("Day : ");
        JLabel yearOfBirthLabel = new JLabel("Year : ");
        JLabel placeOfBirthLabel = new JLabel("Place of Birth : ");
        JLabel addressLabel = new JLabel("Address : ");
        JLabel parentLabel = new JLabel("Parent/Guardian : ");
        JLabel occupationLabel = new JLabel("Occupation : ");
        JLabel medicalHistoryLabel = new JLabel("Medical History : ");
 
  /*----------------------------buttons----------------------------------*/        
             
		JButton submit1 = new JButton("Submit");
		JButton reset1= new JButton("Reset");
 
  /*------------------------panels for add new student record-------------------------*/
        final JPanel nullPanel1 = new JPanel();
        final JPanel nullPanel2 = new JPanel();
        JPanel nullPanel3 = new JPanel();
        JPanel nullPanel4 = new JPanel();
        JPanel nullPanel5 = new JPanel();
        JPanel nullPanel6 = new JPanel();
        JPanel nullPanel7 = new JPanel();
        final JPanel nullPanel8 = new JPanel();
        JPanel nullPanel100= new JPanel();
        

        nullPanel1.setOpaque(false);
        nullPanel2.setOpaque(false);
        nullPanel3.setOpaque(false);
        nullPanel4.setOpaque(false);
        nullPanel5.setOpaque(false);
        nullPanel6.setOpaque(false);
        nullPanel7.setOpaque(false);
        nullPanel8.setOpaque(false);
        nullPanel100.setOpaque(false);
        
        JPanel addStudentPanel = new JPanel(new GridLayout(20,1)){
        	public void paintComponent(Graphics g){
        		g.drawImage(semiBG, 0, 0, this);
        		super.paintComponent(g);
        	}
        };
        addStudentPanel.setOpaque(false);
        addStudentPanel.setVisible(true);
        
        
        JPanel namePanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel dateOfBirthPanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel gradePanel = new JPanel(new FlowLayout(SwingConstants.CENTER));        
        JPanel placeOfBirthPanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel addressPanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel parentPanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel occupationPanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel medicalHistoryPanel = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel buttonsPanel = new JPanel(new FlowLayout());
        
        
        dateOfBirthPanel.setOpaque(false);
        gradePanel.setOpaque(false);
        placeOfBirthPanel.setOpaque(false);
        addressPanel.setOpaque(false);
        parentPanel.setOpaque(false);
        occupationPanel.setOpaque(false);
        medicalHistoryPanel.setOpaque(false);
        buttonsPanel.setOpaque(false);
  
   /*----------------------------layouting----------------------------------*/        
               
        namePanel.add(surnameLabel);
        namePanel.add(surnameTextField);
        namePanel.add(firstNameLabel);
        namePanel.add(firstNameTextField);
        namePanel.add(midNameLabel);
        namePanel.add(midNameTextField);
        
        addStudentPanel.add(nullPanel1);
        addStudentPanel.add(namePanel);
        addStudentPanel.add(nullPanel2);
 
        gradePanel.add(gradeLabel);
        gradePanel.add(grade);
        gradePanel.add(sectionLabel);
        gradePanel.add(section);
        gradePanel.add(ageLabel);
        gradePanel.add(ageTextField);
        gradePanel.add(sexLabel);
        gradePanel.add(sexComboBox);
        
        addStudentPanel.add(gradePanel);
        addStudentPanel.add(nullPanel100);
               
        dateOfBirthPanel.add(dateOfBirthLabel);
        dateOfBirthPanel.add(monthOfBirthLabel);
        dateOfBirthPanel.add(monthOfBirth);
        dateOfBirthPanel.add(dayOfBirthLabel);
        dateOfBirthPanel.add(dayOfBirth);
        dateOfBirthPanel.add(yearOfBirthLabel);
        dateOfBirthPanel.add(yearOfBirth);
        
        addStudentPanel.add(dateOfBirthPanel);
        addStudentPanel.add(nullPanel3);
 
        placeOfBirthPanel.add(placeOfBirthLabel);
        placeOfBirthPanel.add(placeOfBirth);
        
        addStudentPanel.add(placeOfBirthPanel);
        addStudentPanel.add(nullPanel4);
		
        addressPanel.add(addressLabel);
        addressPanel.add(address);
        
        addStudentPanel.add(addressPanel);
        addStudentPanel.add(nullPanel5);
		
        parentPanel.add(parentLabel);
        parentPanel.add(parent);
        addStudentPanel.add(parentPanel);
        addStudentPanel.add(nullPanel6);
        
        occupationPanel.add(occupationLabel);
        occupationPanel.add(occupation);
        
        addStudentPanel.add(occupationPanel);
        addStudentPanel.add(nullPanel7);
        
        medicalHistoryPanel.add(medicalHistoryLabel);
        medicalHistoryPanel.add(medicalHistory);
        
        addStudentPanel.add(medicalHistoryPanel);
        addStudentPanel.add(nullPanel8);
        
        buttonsPanel.add(submit1);
        buttonsPanel.add(reset1);

        addStudentPanel.add(buttonsPanel);
  
        tabbedPane.addTab("Add Student", tooth01, addStudentPanel,
                "Click this tab to add a new student record");
        tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);        
/*ihiwalay na class para hindi final (JtextField ang parameter)*/
        submit1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
  /*          	
            	String surname = .getText();
            	String firstname = .getText();
                String mi = .getText();
                String date = .getText();               
                String age = .getText();
                String sex = .getText();
                String bplace = .getText();
                String addresss = .getText(); 
                String parents = .getText();
                String occu = .getText();
                String medhist = .getText();
                String grades = grade.getText();
                String sections = section.getText();
                String month = monthOfBirth.getText();
                String day = dayOfBirth.getText();
                String year = yearOfBirth.getText();
*/                
                ActionContainer ac = new ActionContainer();
                ac.addAction(e,nullPanel2,surnameTextField,firstNameTextField,midNameTextField,ageTextField,sexComboBox,
                		placeOfBirth,address,parent,occupation,medicalHistory,grade,section,monthOfBirth,dayOfBirth,yearOfBirth);
        		                

            }
        });
        
        reset1.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                ActionContainer ac = new ActionContainer();
                ac.addReset(e,1,surnameTextField,firstNameTextField,midNameTextField,ageTextField,sexComboBox,
                		placeOfBirth,address,parent,occupation,medicalHistory,grade,section,monthOfBirth,dayOfBirth,yearOfBirth);
        		                

            }
        });

/*---------------------------------------------------------------------------*/        
/*---------------------------------------------------------------------------*/        
        String presentString = "Present";
        String absentString = "Absent";
       
      //radio button group 1
        final JRadioButton present1 = new JRadioButton(presentString);
        present1.setActionCommand(presentString);
        present1.setEnabled(false);

        
        final JRadioButton absent1 = new JRadioButton(absentString);
        absent1.setActionCommand(absentString);
        absent1.setSelected(true);
        absent1.setEnabled(false);
        
        ButtonGroup group1 = new ButtonGroup();
        group1.add(present1);
        group1.add(absent1);
       
      //radio button group 2
        final JRadioButton present2 = new JRadioButton(presentString);
        present2.setActionCommand(presentString);
        present2.setEnabled(false);
        
        final JRadioButton absent2 = new JRadioButton(absentString);
        absent2.setActionCommand(absentString);
        absent2.setSelected(true);
        absent2.setEnabled(false);
        
        ButtonGroup group2 = new ButtonGroup();
        group2.add(present2);
        group2.add(absent2);
        
      //radio button group 3
        final JRadioButton present3 = new JRadioButton(presentString);
        present3.setActionCommand(presentString);
        present3.setEnabled(false);
        
        final JRadioButton absent3 = new JRadioButton(absentString);
        absent3.setActionCommand(absentString);
        absent3.setSelected(true);
        absent3.setEnabled(false);
        
        ButtonGroup group3 = new ButtonGroup();
        group3.add(present3);
        group3.add(absent3);
        
        //radio button group 4
        final JRadioButton present4 = new JRadioButton(presentString);
        present4.setActionCommand(presentString);
        present4.setEnabled(false);
        
        final JRadioButton absent4 = new JRadioButton(absentString);
        absent4.setActionCommand(absentString);
        absent4.setSelected(true);
        absent4.setEnabled(false);
        
        ButtonGroup group4 = new ButtonGroup();
        group4.add(present4);
        group4.add(absent4);
        
      //radio button group 5

        final JRadioButton present5 = new JRadioButton(presentString);
        present5.setActionCommand(presentString);
        present5.setEnabled(false);
        
        final JRadioButton absent5 = new JRadioButton(absentString);
        absent5.setActionCommand(absentString);
        absent5.setSelected(true);
        absent5.setEnabled(false);
        
        ButtonGroup group5 = new ButtonGroup();
        group5.add(present5);
        group5.add(absent5);
        
      //radio button group 6
        final JRadioButton present6 = new JRadioButton(presentString);
        present6.setActionCommand(presentString);
        present6.setEnabled(false);
        
        final JRadioButton absent6 = new JRadioButton(absentString);
        absent6.setActionCommand(absentString);
        absent6.setSelected(true);
        absent6.setEnabled(false);
        
        ButtonGroup group6 = new ButtonGroup();
        group6.add(present6);
        group6.add(absent6);
        
      //radio button group 7
        final JRadioButton present7 = new JRadioButton(presentString);
        present7.setActionCommand(presentString);
        present7.setEnabled(false);
        
        final JRadioButton absent7 = new JRadioButton(absentString);
        absent7.setActionCommand(absentString);
        absent7.setSelected(true);
        absent7.setEnabled(false);
        
        ButtonGroup group7 = new ButtonGroup();
        group7.add(present7);
        group7.add(absent7);

/*-----------------panels for add initial health condition----------------------*/
        JPanel nullPanel9 = new JPanel();
        final JPanel nullPanel10 = new JPanel();
        final JPanel nullPanel11 = new JPanel();
        JPanel nullPanel12 = new JPanel();
        JPanel nullRadioPanel1 = new JPanel();
        JPanel nullRadioPanel2 = new JPanel();
        JPanel nullRadioPanel3 = new JPanel();
        JPanel nullRadioPanel4 = new JPanel();
        JPanel nullRadioPanel5 = new JPanel();
        JPanel nullRadioPanel6 = new JPanel();
        JPanel nullRadioPanel7 = new JPanel();
        JPanel addInitPanel = new JPanel(new GridLayout(20,0));
        
        JPanel searchPanel2 = new JPanel(new FlowLayout());
        JPanel currentDatePanel = new JPanel(new FlowLayout());
        JPanel radioPanel1 = new JPanel(new GridLayout(0,5));
        JPanel radioPanel2 = new JPanel(new GridLayout(0,5));
        JPanel radioPanel3 = new JPanel(new GridLayout(0,5));
        JPanel radioPanel4 = new JPanel(new GridLayout(0,5));
        JPanel radioPanel5 = new JPanel(new GridLayout(0,5));
        JPanel radioPanel6 = new JPanel(new GridLayout(0,5));
        JPanel radioPanel7 = new JPanel(new GridLayout(0,5));
        JPanel buttonsPanel2 = new JPanel(new FlowLayout());

/*-----------------text fields for add initial health condition----------------------*/
        
        final JTextField surnameSearch2 = new JTextField(20);
        final JTextField firstNameSearch2 = new JTextField(20);
        final JTextField midNameSearch2 = new JTextField(3);
        
        
        final JComboBox monthOfExam1 = new JComboBox(monthSelect);
        monthOfExam1.setEditable(false);
        monthOfExam1.setEnabled(false);
        
        //gawing spinner
        final JComboBox dayOfExam1 = new JComboBox(daySelect);
        dayOfExam1.setEditable(false);
        dayOfExam1.setEnabled(false);
        
        //gawing spinner
        final JTextField yearOfExam1 = new JTextField(6);
        yearOfExam1.setEnabled(false);
        yearOfExam1.setEnabled(false);
        
        String dateOfExam = "";

/*-----------------labels for add initial health condition----------------------*/

        JLabel currentDateLabel = new JLabel("Date of Oral Examination : ");
        JLabel currentMonthLabel = new JLabel("Month : ");
        JLabel currentDayLabel = new JLabel("Day : ");
        JLabel currentYearLabel = new JLabel("Year : ");
        JLabel surnameLabel2 = new JLabel("Surname : ");
        JLabel firstNameLabel2 = new JLabel("First Name : ");
        JLabel midNameLabel2 = new JLabel("MI : ");
        JLabel radioPanel1Label = new JLabel("Dental Caries : ");
        JLabel radioPanel2Label = new JLabel("Gingivitis Periodontal Disese : ");
        JLabel radioPanel3Label = new JLabel("Debris : ");
        JLabel radioPanel4Label = new JLabel("Calculus : ");
        JLabel radioPanel5Label = new JLabel("Abnormal Growth : ");
        JLabel radioPanel6Label = new JLabel("Cleft Lip/Palate : ");
        JLabel radioPanel7Label = new JLabel("Others(supernumerary etc.) : ");
                
/*-----------------buttons for add initial health condition----------------------*/
        
        final JButton submit2 = new JButton("Add Initial Oral Health Condition");
        submit2.setEnabled(false);
		JButton reset2= new JButton("Reset");
		JButton search2 = new JButton("Search");
		
/*-----------------layouting for add initial health condition----------------------*/
        addInitPanel.add(nullPanel9);
        searchPanel2.add(surnameLabel2);
        searchPanel2.add(surnameSearch2);
        searchPanel2.add(firstNameLabel2);
        searchPanel2.add(firstNameSearch2);
        searchPanel2.add(midNameLabel2);
        searchPanel2.add(midNameSearch2);
        searchPanel2.add(search2);
        
        addInitPanel.add(searchPanel2);
        addInitPanel.add(nullPanel10);
        
        currentDatePanel.add(currentDateLabel);
        currentDatePanel.add(currentMonthLabel);
        currentDatePanel.add(monthOfExam1);
        currentDatePanel.add(currentDayLabel);
        currentDatePanel.add(dayOfExam1);
        currentDatePanel.add(currentYearLabel);
        currentDatePanel.add(yearOfExam1);
        
        addInitPanel.add(currentDatePanel);
        addInitPanel.add(nullPanel11);
        
        radioPanel1.add(nullRadioPanel1);
        radioPanel1.add(radioPanel1Label);
        radioPanel1.add(present1);
        radioPanel1.add(absent1);
        addInitPanel.add(radioPanel1);
        
        radioPanel2.add(nullRadioPanel2);
        radioPanel2.add(radioPanel2Label);
        radioPanel2.add(present2);
        radioPanel2.add(absent2);
        addInitPanel.add(radioPanel2);
        
        radioPanel3.add(nullRadioPanel3);
        radioPanel3.add(radioPanel3Label);
        radioPanel3.add(present3);
        radioPanel3.add(absent3);
        addInitPanel.add(radioPanel3);
        
        radioPanel4.add(nullRadioPanel4);
        radioPanel4.add(radioPanel4Label);
        radioPanel4.add(present4);
        radioPanel4.add(absent4);
        addInitPanel.add(radioPanel4);
        
        radioPanel5.add(nullRadioPanel5);
        radioPanel5.add(radioPanel5Label);
        radioPanel5.add(present5);
        radioPanel5.add(absent5);
        addInitPanel.add(radioPanel5);
        
        radioPanel6.add(nullRadioPanel6);
        radioPanel6.add(radioPanel6Label);
        radioPanel6.add(present6);
        radioPanel6.add(absent6);
        addInitPanel.add(radioPanel6);
        
        radioPanel7.add(nullRadioPanel7);
        radioPanel7.add(radioPanel7Label);
        radioPanel7.add(present7);
        radioPanel7.add(absent7);
        addInitPanel.add(radioPanel7);
        addInitPanel.add(nullPanel12);
        
        buttonsPanel2.add(submit2);
        buttonsPanel2.add(reset2);

        addInitPanel.add(buttonsPanel2);
        
        tabbedPane.addTab("Add Initial Oral Health Condition", tooth01, addInitPanel,
                "Click this tab to add an initial oral health condition");
        tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
    
        search2.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	String sur = "";
            	String fN = "";
            	String mI = "";
            	String sur2 = "";
            	String fN2 = "";
            	String mI2 = "";
            	String surname = surnameSearch2.getText();
              	String firstname = firstNameSearch2.getText();
              	String mi = midNameSearch2.getText();
              	surname = surname.toLowerCase();
              	firstname = firstname.toLowerCase();
              	mi = mi.toLowerCase();
                SearchView search = new SearchView();
                try {
                	
                	s = search.search(surname,firstname,mi);
                	if(s!=null){
                	sur = s.getSurname();
                	fN = s.getFirstname();
                	mI = s.getMi();
                	sur2 = sur.toLowerCase();
                	fN2 = fN.toLowerCase();
                	mI2 = mI.toLowerCase();
                	}
                	if((surname.length()==0)||(firstname.length()==0)||(mi.length()==0)){
                		JOptionPane.showMessageDialog( nullPanel11,"Missing Inputs","ERROR!", 0);	
                	}
                	else if (surname.equals(sur2)&&firstname.equals(fN2)&&mi.equals(mI2)){
                		JOptionPane.showMessageDialog( nullPanel11, fN+ " " + mI+ " " + sur + " found","Student Found", 1);
                		
                		monthOfExam1.setSelectedItem("");
            	        monthOfExam1.setEditable(false);
            	        dayOfExam1.setSelectedItem("");
            	        dayOfExam1.setEditable(false);
            	        yearOfExam1.setText("");
            	        yearOfExam1.setEditable(false);
            	        absent1.setSelected(true);
            	        absent2.setSelected(true);
            	        absent3.setSelected(true);
            	        absent4.setSelected(true);
            	        absent5.setSelected(true);
            	        absent6.setSelected(true);
            	        absent7.setSelected(true);
            	        present1.setEnabled(false);
                		present2.setEnabled(false);
                		present3.setEnabled(false);
                		present4.setEnabled(false);
                		present5.setEnabled(false);
                		present6.setEnabled(false);
                		present7.setEnabled(false);
                		absent1.setEnabled(false);
                		absent2.setEnabled(false);
                		absent3.setEnabled(false);
                		absent4.setEnabled(false);
                		absent5.setEnabled(false);
                		absent6.setEnabled(false);
                		absent7.setEnabled(false);
                		submit2.setEnabled(false);
                	
                		
                		monthOfExam1.setEnabled(true);
            	        dayOfExam1.setEnabled(true);
            	        yearOfExam1.setEditable(true);
            	        yearOfExam1.setEnabled(true);
                    	
                		
                		present1.setEnabled(true);
                		present2.setEnabled(true);
                		present3.setEnabled(true);
                		present4.setEnabled(true);
                		present5.setEnabled(true);
                		present6.setEnabled(true);
                		present7.setEnabled(true);
                		absent1.setEnabled(true);
                		absent2.setEnabled(true);
                		absent3.setEnabled(true);
                		absent4.setEnabled(true);
                		absent5.setEnabled(true);
                		absent6.setEnabled(true);
                		absent7.setEnabled(true);
                		submit2.setEnabled(true);
                		
                	}
                	else{
                		JOptionPane.showMessageDialog( nullPanel10,"Student not found","Student Not Found!", 0);
                	}
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					JOptionPane.showMessageDialog( nullPanel10,"Student not found","Student Not Found!", 0);
					e1.printStackTrace();
				}
            }
        });
        
        submit2.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
            	
            	//String surname = present6.getActionCommand();
//            	present6.isSelected();
        
            	int studentID = s.getStudentID();
            	 String dateOfExam;
         	    boolean dentalCaries;
         	    boolean gingivitis;
         	    boolean debris;
         	    boolean calculus;
         	    boolean abnormalGrowth;
         	    boolean cleftLip;
         	    boolean other;
         	    
         	   dateOfExam = (String)monthOfExam1.getSelectedItem() +" " + (String)dayOfExam1.getSelectedItem()+", "+ yearOfExam1.getText();
        	
        		if(!absent1.isSelected()) dentalCaries = true;
        		else dentalCaries = false;
        		
 
        		if(!absent2.isSelected()) gingivitis = true;
        		else gingivitis = false;

        	
        		if(!absent3.isSelected()) debris = true;
        		else debris = false;

        		
        		if(!absent4.isSelected()) calculus = true;
        		else calculus = false;
        		
        		
        		if(!absent5.isSelected()) abnormalGrowth = true;
        		else abnormalGrowth = false;
        			
        		
        		if(!absent6.isSelected()) cleftLip = true;
        		else cleftLip = false;		
        		
        		
        		if(!absent7.isSelected()) other = true;
        		else other = false;
        		
        		AddInitialConditionView aicv = new AddInitialConditionView();
        		try {if(dateOfExam.length()>0){
					aicv.sendAddInitialConditionRequest(studentID, dateOfExam, 
							dentalCaries,gingivitis, debris,calculus, abnormalGrowth,
							cleftLip, other);}
        		else{
        			JOptionPane.showMessageDialog( nullPanel10,"Please enter date","Error!", 0);	
        		}
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            }
        });

        reset2.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
            	
            	  try {
            		  surnameSearch2.setText("");
            	      firstNameSearch2.setText("");
            	      midNameSearch2.setText("");
            	        
            	        
            	        monthOfExam1.setSelectedItem("");
            	        monthOfExam1.setEditable(false);
            	        dayOfExam1.setSelectedItem("");
            	        dayOfExam1.setEditable(false);
            	        yearOfExam1.setText("");
            	        yearOfExam1.setEditable(false);
            	        absent1.setSelected(true);
            	        absent2.setSelected(true);
            	        absent3.setSelected(true);
            	        absent4.setSelected(true);
            	        absent5.setSelected(true);
            	        absent6.setSelected(true);
            	        absent7.setSelected(true);
            	        present1.setEnabled(false);
                		present2.setEnabled(false);
                		present3.setEnabled(false);
                		present4.setEnabled(false);
                		present5.setEnabled(false);
                		present6.setEnabled(false);
                		present7.setEnabled(false);
                		absent1.setEnabled(false);
                		absent2.setEnabled(false);
                		absent3.setEnabled(false);
                		absent4.setEnabled(false);
                		absent5.setEnabled(false);
                		absent6.setEnabled(false);
                		absent7.setEnabled(false);
                		submit2.setEnabled(false);
                	
            	       
            		  
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            }
        });

/*---------------------------------------------------------------------------*/        
/*---------------------------------------------------------------------------*/        

/*-----------------panels for add DMFX condition----------------------*/        
        JPanel nullPanel13 = new JPanel();
        final JPanel nullPanel14 = new JPanel();
        final JPanel nullPanel15 = new JPanel();
        JPanel nullPanel16 = new JPanel();
        JPanel nullPanel110 = new JPanel();
        JPanel currentDatePanel2 = new JPanel(new FlowLayout());
        JPanel addDMFXPanel = new JPanel(new GridLayout(20,0));
        JPanel searchPanel3 = new JPanel(new FlowLayout());
        JPanel buttonsPanel3 = new JPanel(new FlowLayout());
        JPanel temp1Panel3 = new JPanel(new FlowLayout());
        JPanel temp2Panel3 = new JPanel(new FlowLayout());
        JPanel perm1Panel3 = new JPanel(new FlowLayout());
        JPanel perm2Panel3 = new JPanel(new FlowLayout());
        JPanel teethLabel1 = new JPanel(new FlowLayout());
        JPanel teethLabel2 = new JPanel(new FlowLayout());
        JPanel teethLabel3 = new JPanel(new FlowLayout());
        JPanel teethLabel4 = new JPanel(new FlowLayout());

/*-----------------text fields for add DMFX condition----------------------*/

        final JTextField surnameSearch3 = new JTextField(20);
        surnameSearch3.addActionListener(this);
                
        final JTextField firstNameSearch3 = new JTextField(20);
        firstNameSearch3.addActionListener(this);
                
        final JTextField midNameSearch3 = new JTextField(3);
        midNameSearch3.addActionListener(this);
        
        final JComboBox monthOfExam2 = new JComboBox(monthSelect);
        monthOfExam2.setEditable(false);
        monthOfExam2.setEnabled(false);
        
        //gawing spinner
        final JComboBox dayOfExam2 = new JComboBox(daySelect);
        dayOfExam2.setEditable(false);
        dayOfExam2.setEnabled(false);
        
        //gawing spinner
        final JTextField yearOfExam2 = new JTextField(6);
        yearOfExam2.setEnabled(false);
        yearOfExam2.setEnabled(false);
        
     
        //  final String dateOfExam2 = "";

/*-----------------labels for add DMFX condition----------------------*/

        JLabel surnameLabel3 = new JLabel("Surname : ");
        JLabel firstNameLabel3 = new JLabel("First Name : ");
        JLabel midNameLabel3 = new JLabel("MI : ");
        
        JLabel temp1Label = new JLabel
        ("55            54            53           52 " +
        		"          51           61           62          63           64             65");
        
        JLabel temp2Label = new JLabel
        ("85            84            83           82 " +
		"          81           71           72          73           74             75");
        
        JLabel perm1Label = new JLabel
        ("18            17             16          15 " +
        "          14          13            12             11" +
        "            21           22            23           24" +
        "           25            26            27            28");
        
        JLabel perm2Label = new JLabel
        ("48            47             46          45 " +
        "          44          43            42             41" +
        "            31           32            33           34" +
        "           35            36            37            38");
        
        JLabel currentDateLabel2 = new JLabel("Date of Oral Examination : ");
        JLabel currentMonthLabel2 = new JLabel("Month : ");
        JLabel currentDayLabel2 = new JLabel("Day : ");
        JLabel currentYearLabel2 = new JLabel("Year : ");
/*-----------------buttons for add DMFX condition----------------------*/
        
        final JButton submit3 = new JButton("Add DMFX Condition");
		JButton reset3= new JButton("Reset");
		JButton search3 = new JButton("Search");

/*-----------------layouting for add DMFX condition----------------------*/
        addDMFXPanel.add(nullPanel13);
        searchPanel3.add(surnameLabel3);
        searchPanel3.add(surnameSearch3);
        searchPanel3.add(firstNameLabel3);
        searchPanel3.add(firstNameSearch3);
        searchPanel3.add(midNameLabel3);
        searchPanel3.add(midNameSearch3);
        searchPanel3.add(search3);
        
        addDMFXPanel.add(searchPanel3);
        addDMFXPanel.add(nullPanel14);
        
        currentDatePanel2.add(currentDateLabel2);
        currentDatePanel2.add(currentMonthLabel2);
        currentDatePanel2.add(monthOfExam2);
        currentDatePanel2.add(currentDayLabel2);
        currentDatePanel2.add(dayOfExam2);
        currentDatePanel2.add(currentYearLabel2);
        currentDatePanel2.add(yearOfExam2);
        
        addDMFXPanel.add(currentDatePanel2);
        addDMFXPanel.add(nullPanel110);

        String[] permanentLegend = {" ","-","D","F","M","X","Un","S","JC","P"};

        String[] temporaryLegend = {" ","/","d","f","m","x","un","s","jc","p"};

        teethLabel1.add(temp1Label);
        addDMFXPanel.add(teethLabel1);
        
        final JComboBox tempLegendList55 = new JComboBox(temporaryLegend);
        tempLegendList55.setEditable(false);
        tempLegendList55.setEnabled(false);
        temp1Panel3.add(tempLegendList55);
        
        final JComboBox tempLegendList54 = new JComboBox(temporaryLegend);
        tempLegendList54.setEditable(false);
        tempLegendList54.setEnabled(false);
        temp1Panel3.add(tempLegendList54);
        
        final JComboBox tempLegendList53 = new JComboBox(temporaryLegend);
        tempLegendList53.setEditable(false);
        tempLegendList53.setEnabled(false);
        temp1Panel3.add(tempLegendList53);
        
        final JComboBox tempLegendList52 = new JComboBox(temporaryLegend);
        tempLegendList52.setEditable(false);
        tempLegendList52.setEnabled(false);
        temp1Panel3.add(tempLegendList52);
        
        final JComboBox tempLegendList51 = new JComboBox(temporaryLegend);
        tempLegendList51.setEditable(false);
        tempLegendList51.setEnabled(false);
        temp1Panel3.add(tempLegendList51);
        
        final JComboBox tempLegendList61 = new JComboBox(temporaryLegend);
        tempLegendList61.setEditable(false);
        tempLegendList61.setEnabled(false);
        temp1Panel3.add(tempLegendList61);
        
        final JComboBox tempLegendList62 = new JComboBox(temporaryLegend);
        tempLegendList62.setEditable(false);
        tempLegendList62.setEnabled(false);
        temp1Panel3.add(tempLegendList62);
        
        final JComboBox tempLegendList63 = new JComboBox(temporaryLegend);
        tempLegendList63.setEditable(false);
        tempLegendList63.setEnabled(false);
        temp1Panel3.add(tempLegendList63);
        
        final JComboBox tempLegendList64 = new JComboBox(temporaryLegend);
        tempLegendList64.setEditable(false);
        tempLegendList64.setEnabled(false);
        temp1Panel3.add(tempLegendList64);
        
        final JComboBox tempLegendList65 = new JComboBox(temporaryLegend);
        tempLegendList65.setEditable(false);
        tempLegendList65.setEnabled(false);
        temp1Panel3.add(tempLegendList65);
        
        /*-------------*/
        addDMFXPanel.add(temp1Panel3);
        /*-------------*/
        
        final JComboBox permLegendList18 = new JComboBox(permanentLegend);
        permLegendList18.setEditable(false);
        permLegendList18.setEnabled(false);
        perm1Panel3.add(permLegendList18);
        
        final JComboBox permLegendList17 = new JComboBox(permanentLegend);
        permLegendList17.setEditable(false);
        permLegendList17.setEnabled(false);
        perm1Panel3.add(permLegendList17);
        
        final JComboBox permLegendList16 = new JComboBox(permanentLegend);
        permLegendList16.setEditable(false);
        permLegendList16.setEnabled(false);
        perm1Panel3.add(permLegendList16);
        
        final JComboBox permLegendList15 = new JComboBox(permanentLegend);
        permLegendList15.setEditable(false);
        permLegendList15.setEnabled(false);
        perm1Panel3.add(permLegendList15);
        
        final JComboBox permLegendList14 = new JComboBox(permanentLegend);
        permLegendList14.setEditable(false);
        permLegendList14.setEnabled(false);
        perm1Panel3.add(permLegendList14);
        
        final JComboBox permLegendList13 = new JComboBox(permanentLegend);
        permLegendList13.setEditable(false);
        permLegendList13.setEnabled(false);
        perm1Panel3.add(permLegendList13);
        
        final JComboBox permLegendList12 = new JComboBox(permanentLegend);
        permLegendList12.setEditable(false);
        permLegendList12.setEnabled(false);
        perm1Panel3.add(permLegendList12);
        
        final JComboBox permLegendList11 = new JComboBox(permanentLegend);
        permLegendList11.setEditable(false);
        permLegendList11.setEnabled(false);
        perm1Panel3.add(permLegendList11);
        
        final JComboBox permLegendList21 = new JComboBox(permanentLegend);
        permLegendList21.setEditable(false);
        permLegendList21.setEnabled(false);
        perm1Panel3.add(permLegendList21);
        
        final JComboBox permLegendList22 = new JComboBox(permanentLegend);
        permLegendList22.setEditable(false);
        permLegendList22.setEnabled(false);
        perm1Panel3.add(permLegendList22);
        
        final JComboBox permLegendList23 = new JComboBox(permanentLegend);
        permLegendList23.setEditable(false);
        permLegendList23.setEnabled(false);
        perm1Panel3.add(permLegendList23);
        
        final JComboBox permLegendList24 = new JComboBox(permanentLegend);
        permLegendList24.setEditable(false);
        permLegendList24.setEnabled(false);
        perm1Panel3.add(permLegendList24);
        
        final JComboBox permLegendList25 = new JComboBox(permanentLegend);
        permLegendList25.setEditable(false);
        permLegendList25.setEnabled(false);
        perm1Panel3.add(permLegendList25);
        
        final JComboBox permLegendList26 = new JComboBox(permanentLegend);
        permLegendList26.setEditable(false);
        permLegendList26.setEnabled(false);
        perm1Panel3.add(permLegendList26);
                
        final JComboBox permLegendList27 = new JComboBox(permanentLegend);
        permLegendList27.setEditable(false);
        permLegendList27.setEnabled(false);
        perm1Panel3.add(permLegendList27);
        
        final JComboBox permLegendList28 = new JComboBox(permanentLegend);
        permLegendList28.setEditable(false);
        permLegendList28.setEnabled(false);
        perm1Panel3.add(permLegendList28);
        
        /*-------------*/
        addDMFXPanel.add(perm1Panel3);
        teethLabel2.add(perm1Label);
        addDMFXPanel.add(teethLabel2);
        addDMFXPanel.add(nullPanel15);
        teethLabel3.add(perm2Label);
        addDMFXPanel.add(teethLabel3);
        /*-------------*/
        
        final JComboBox permLegendList48 = new JComboBox(permanentLegend);
        permLegendList48.setEditable(false);
        permLegendList48.setEnabled(false);
        perm2Panel3.add(permLegendList48);
        
        final JComboBox permLegendList47 = new JComboBox(permanentLegend);
        permLegendList47.setEditable(false);
        permLegendList47.setEnabled(false);
        perm2Panel3.add(permLegendList47);
        
        final JComboBox permLegendList46 = new JComboBox(permanentLegend);
        permLegendList46.setEditable(false);
        permLegendList46.setEnabled(false);
        perm2Panel3.add(permLegendList46);
        
        final JComboBox permLegendList45 = new JComboBox(permanentLegend);
        permLegendList45.setEditable(false);
        permLegendList45.setEnabled(false);
        perm2Panel3.add(permLegendList45);
        
        final JComboBox permLegendList44 = new JComboBox(permanentLegend);
        permLegendList44.setEditable(false);
        permLegendList44.setEnabled(false);
        perm2Panel3.add(permLegendList44);
        
        final JComboBox permLegendList43 = new JComboBox(permanentLegend);
        permLegendList43.setEditable(false);
        permLegendList43.setEnabled(false);
        perm2Panel3.add(permLegendList43);
        
        final JComboBox permLegendList42 = new JComboBox(permanentLegend);
        permLegendList42.setEditable(false);
        permLegendList42.setEnabled(false);
        perm2Panel3.add(permLegendList42);
        
        final JComboBox permLegendList41 = new JComboBox(permanentLegend);
        permLegendList41.setEditable(false);
        permLegendList41.setEnabled(false);
        perm2Panel3.add(permLegendList41);
        
        final JComboBox permLegendList31 = new JComboBox(permanentLegend);
        permLegendList31.setEditable(false);
        permLegendList31.setEnabled(false);
        perm2Panel3.add(permLegendList31);
        
        final JComboBox permLegendList32 = new JComboBox(permanentLegend);
        permLegendList32.setEditable(false);
        permLegendList32.setEnabled(false);
        perm2Panel3.add(permLegendList32);
        
        final JComboBox permLegendList33 = new JComboBox(permanentLegend);
        permLegendList33.setEditable(false);
        permLegendList33.setEnabled(false);
        perm2Panel3.add(permLegendList33);
        
        final JComboBox permLegendList34 = new JComboBox(permanentLegend);
        permLegendList34.setEditable(false);
        permLegendList34.setEnabled(false);
        perm2Panel3.add(permLegendList34);
        
        final JComboBox permLegendList35 = new JComboBox(permanentLegend);
        permLegendList35.setEditable(false);
        permLegendList35.setEnabled(false);
        perm2Panel3.add(permLegendList35);
        
        final JComboBox permLegendList36 = new JComboBox(permanentLegend);
        permLegendList36.setEditable(false);
        permLegendList36.setEnabled(false);
        perm2Panel3.add(permLegendList36);
        
        final JComboBox permLegendList37 = new JComboBox(permanentLegend);
        permLegendList37.setEditable(false);
        permLegendList37.setEnabled(false);
        perm2Panel3.add(permLegendList37);
        
        final JComboBox permLegendList38 = new JComboBox(permanentLegend);
        permLegendList38.setEditable(false);
        permLegendList38.setEnabled(false);
        perm2Panel3.add(permLegendList38);
        
        /*-------------*/
        addDMFXPanel.add(perm2Panel3);
        /*-------------*/
        
        final JComboBox tempLegendList85 = new JComboBox(temporaryLegend);
        tempLegendList85.setEditable(false);
        tempLegendList85.setEnabled(false);
        temp2Panel3.add(tempLegendList85);
        
        final JComboBox tempLegendList84 = new JComboBox(temporaryLegend);
        tempLegendList84.setEditable(false);
        tempLegendList84.setEnabled(false);
        temp2Panel3.add(tempLegendList84);
        
        final JComboBox tempLegendList83 = new JComboBox(temporaryLegend);
        tempLegendList83.setEditable(false);
        tempLegendList83.setEnabled(false);
        temp2Panel3.add(tempLegendList83);
        
        final JComboBox tempLegendList82 = new JComboBox(temporaryLegend);
        tempLegendList82.setEditable(false);
        tempLegendList82.setEnabled(false);
        temp2Panel3.add(tempLegendList82);
        
        final JComboBox tempLegendList81 = new JComboBox(temporaryLegend);
        tempLegendList81.setEditable(false);
        tempLegendList81.setEnabled(false);
        temp2Panel3.add(tempLegendList81);
        
        final JComboBox tempLegendList71 = new JComboBox(temporaryLegend);
        tempLegendList71.setEditable(false);
        tempLegendList71.setEnabled(false);
        temp2Panel3.add(tempLegendList71);
        
        final JComboBox tempLegendList72 = new JComboBox(temporaryLegend);
        tempLegendList72.setEditable(false);
        tempLegendList72.setEnabled(false);
        temp2Panel3.add(tempLegendList72);
        
        final JComboBox tempLegendList73 = new JComboBox(temporaryLegend);
        tempLegendList73.setEditable(false);
        tempLegendList73.setEnabled(false);
        temp2Panel3.add(tempLegendList73);
        
        final JComboBox tempLegendList74 = new JComboBox(temporaryLegend);
        tempLegendList74.setEditable(false);
        tempLegendList74.setEnabled(false);
        temp2Panel3.add(tempLegendList74);
        
        final JComboBox tempLegendList75 = new JComboBox(temporaryLegend);
        tempLegendList75.setEditable(false);
        tempLegendList75.setEnabled(false);
        temp2Panel3.add(tempLegendList75);
        /*-------------*/
        addDMFXPanel.add(temp2Panel3);
        teethLabel4.add(temp2Label);
        addDMFXPanel.add(teethLabel4);
        addDMFXPanel.add(nullPanel16);
        /*-------------*/
        
        buttonsPanel3.add(submit3);
        submit3.setEnabled(false);
        buttonsPanel3.add(reset3);

        addDMFXPanel.add(buttonsPanel3);

        
        tabbedPane.addTab("Add DMFX Condition", tooth01, addDMFXPanel,
                "Click this tab to add dmfx condition");
        tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);

        search3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	String sur = "";
            	String fN = "";
            	String mI = "";
            	String sur2 = "";
            	String fN2 = "";
            	String mI2 = "";
            	String surname = surnameSearch3.getText();
              	String firstname = firstNameSearch3.getText();
              	String mi = midNameSearch3.getText();
                SearchView search = new SearchView();
                try {
                	dmfx = search.search(surname,firstname,mi);
                	if(dmfx!=null){
                	sur = dmfx.getSurname();
                	fN = dmfx.getFirstname();
                	mI = dmfx.getMi();
                	sur2 = sur.toLowerCase();
                	fN2 = fN.toLowerCase();
                	mI2 = mI.toLowerCase();
                	surname = surname.toLowerCase();
                  	firstname = firstname.toLowerCase();
                  	mi = mi.toLowerCase();
                	}
                	
                	if((surname.length()==0)||(firstname.length()==0)||(mi.length()==0)){
                		JOptionPane.showMessageDialog( nullPanel11,"Missing Inputs","ERROR!", 0);	
                	}
                	else if (surname.equals(sur2)&&firstname.equals(fN2)&&mi.equals(mI2)){
                		JOptionPane.showMessageDialog( nullPanel11, fN+ " " + mI+ " " + sur + " found","Student Found", 1);
                		
              	        monthOfExam2.setSelectedItem("");
              	        monthOfExam2.setEditable(false);
              	        monthOfExam2.setEnabled(false);
              	        dayOfExam2.setSelectedItem("");
              	        dayOfExam2.setEditable(false);
              	        dayOfExam2.setEnabled(false);
              	        yearOfExam2.setText("");
              	        yearOfExam2.setEditable(false);
              	        
              	        permLegendList18.setSelectedItem(" ");
                          permLegendList17.setSelectedItem(" ");
                          permLegendList16.setSelectedItem(" ");
                          permLegendList15.setSelectedItem(" ");
                          permLegendList14.setSelectedItem(" ");
                          permLegendList13.setSelectedItem(" ");
                          permLegendList12.setSelectedItem(" ");
                          permLegendList11.setSelectedItem(" ");
                          permLegendList21.setSelectedItem(" ");
                          permLegendList22.setSelectedItem(" ");
                          permLegendList23.setSelectedItem(" ");
                          permLegendList24.setSelectedItem(" ");
                          permLegendList25.setSelectedItem(" ");
                          permLegendList26.setSelectedItem(" ");
                          permLegendList27.setSelectedItem(" ");
                          permLegendList28.setSelectedItem(" ");
                          permLegendList48.setSelectedItem(" ");
                          permLegendList47.setSelectedItem(" ");
                          permLegendList46.setSelectedItem(" ");
                          permLegendList45.setSelectedItem(" ");
                          permLegendList44.setSelectedItem(" ");
                          permLegendList43.setSelectedItem(" ");
                          permLegendList42.setSelectedItem(" ");
                          permLegendList41.setSelectedItem(" ");
                          permLegendList31.setSelectedItem(" ");
                          permLegendList32.setSelectedItem(" ");
                          permLegendList33.setSelectedItem(" ");
                          permLegendList34.setSelectedItem(" ");
                          permLegendList35.setSelectedItem(" ");
                          permLegendList36.setSelectedItem(" ");
                          permLegendList37.setSelectedItem(" ");
                          permLegendList38.setSelectedItem(" ");
                          tempLegendList85.setSelectedItem(" ");
                          tempLegendList84.setSelectedItem(" ");
                          tempLegendList83.setSelectedItem(" ");
                          tempLegendList82.setSelectedItem(" ");
                          tempLegendList81.setSelectedItem(" ");
                          tempLegendList71.setSelectedItem(" ");
                          tempLegendList72.setSelectedItem(" ");
                          tempLegendList73.setSelectedItem(" ");
                          tempLegendList74.setSelectedItem(" ");
                          tempLegendList75.setSelectedItem(" ");
                          tempLegendList55.setSelectedItem(" ");
                          tempLegendList54.setSelectedItem(" ");
                          tempLegendList53.setSelectedItem(" ");
                          tempLegendList52.setSelectedItem(" ");
                          tempLegendList51.setSelectedItem(" ");
                          tempLegendList61.setSelectedItem(" ");
                          tempLegendList62.setSelectedItem(" ");
                          tempLegendList63.setSelectedItem(" ");
                          tempLegendList64.setSelectedItem(" ");
                          tempLegendList65.setSelectedItem(" ");

              	        permLegendList18.setEnabled(false);
                          permLegendList17.setEnabled(false);
                          permLegendList16.setEnabled(false);
                          permLegendList15.setEnabled(false);
                          permLegendList14.setEnabled(false);
                          permLegendList13.setEnabled(false);
                          permLegendList12.setEnabled(false);
                          permLegendList11.setEnabled(false);
                          permLegendList21.setEnabled(false);
                          permLegendList22.setEnabled(false);
                          permLegendList23.setEnabled(false);
                          permLegendList24.setEnabled(false);
                          permLegendList25.setEnabled(false);
                          permLegendList26.setEnabled(false);
                          permLegendList27.setEnabled(false);
                          permLegendList28.setEnabled(false);
                          permLegendList48.setEnabled(false);
                          permLegendList47.setEnabled(false);
                          permLegendList46.setEnabled(false);
                          permLegendList45.setEnabled(false);
                          permLegendList44.setEnabled(false);
                          permLegendList43.setEnabled(false);
                          permLegendList42.setEnabled(false);
                          permLegendList41.setEnabled(false);
                          permLegendList31.setEnabled(false);
                          permLegendList32.setEnabled(false);
                          permLegendList33.setEnabled(false);
                          permLegendList34.setEnabled(false);
                          permLegendList35.setEnabled(false);
                          permLegendList36.setEnabled(false);
                          permLegendList37.setEnabled(false);
                          permLegendList38.setEnabled(false);
                          tempLegendList85.setEnabled(false);
                          tempLegendList84.setEnabled(false);
                          tempLegendList83.setEnabled(false);
                          tempLegendList82.setEnabled(false);
                          tempLegendList81.setEnabled(false);
                          tempLegendList71.setEnabled(false);
                          tempLegendList72.setEnabled(false);
                          tempLegendList73.setEnabled(false);
                          tempLegendList74.setEnabled(false);
                          tempLegendList75.setEnabled(false);
                          tempLegendList55.setEnabled(false);
                          tempLegendList54.setEnabled(false);
                          tempLegendList53.setEnabled(false);
                          tempLegendList52.setEnabled(false);
                          tempLegendList51.setEnabled(false);
                          tempLegendList61.setEnabled(false);
                          tempLegendList62.setEnabled(false);
                          tempLegendList63.setEnabled(false);
                          tempLegendList64.setEnabled(false);
                          tempLegendList65.setEnabled(false);
                          submit3.setEnabled(false);

                		
                		monthOfExam2.setEnabled(true);
            	        dayOfExam2.setEnabled(true);
            	        yearOfExam2.setEditable(true);
            	        yearOfExam2.setEnabled(true);
                    	
                        
                        permLegendList18.setEnabled(true);
                        permLegendList17.setEnabled(true);
                        permLegendList16.setEnabled(true);
                        permLegendList15.setEnabled(true);
                        permLegendList14.setEnabled(true);
                        permLegendList13.setEnabled(true);
                        permLegendList12.setEnabled(true);
                        permLegendList11.setEnabled(true);
                        permLegendList21.setEnabled(true);
                        permLegendList22.setEnabled(true);
                        permLegendList23.setEnabled(true);
                        permLegendList24.setEnabled(true);
                        permLegendList25.setEnabled(true);
                        permLegendList26.setEnabled(true);
                        permLegendList27.setEnabled(true);
                        permLegendList28.setEnabled(true);
                        permLegendList48.setEnabled(true);
                        permLegendList47.setEnabled(true);
                        permLegendList46.setEnabled(true);
                        permLegendList45.setEnabled(true);
                        permLegendList44.setEnabled(true);
                        permLegendList43.setEnabled(true);
                        permLegendList42.setEnabled(true);
                        permLegendList41.setEnabled(true);
                        permLegendList31.setEnabled(true);
                        permLegendList32.setEnabled(true);
                        permLegendList33.setEnabled(true);
                        permLegendList34.setEnabled(true);
                        permLegendList35.setEnabled(true);
                        permLegendList36.setEnabled(true);
                        permLegendList37.setEnabled(true);
                        permLegendList38.setEnabled(true);
                        tempLegendList85.setEnabled(true);
                        tempLegendList84.setEnabled(true);
                        tempLegendList83.setEnabled(true);
                        tempLegendList82.setEnabled(true);
                        tempLegendList81.setEnabled(true);
                        tempLegendList71.setEnabled(true);
                        tempLegendList72.setEnabled(true);
                        tempLegendList73.setEnabled(true);
                        tempLegendList74.setEnabled(true);
                        tempLegendList75.setEnabled(true);
                        tempLegendList55.setEnabled(true);
                        tempLegendList54.setEnabled(true);
                        tempLegendList53.setEnabled(true);
                        tempLegendList52.setEnabled(true);
                        tempLegendList51.setEnabled(true);
                        tempLegendList61.setEnabled(true);
                        tempLegendList62.setEnabled(true);
                        tempLegendList63.setEnabled(true);
                        tempLegendList64.setEnabled(true);
                        tempLegendList65.setEnabled(true);
                        submit3.setEnabled(true);
                		
                	}
                	else{
                		JOptionPane.showMessageDialog( nullPanel11,"Student not found","Student Not Found!", 0);
                	}
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					JOptionPane.showMessageDialog( nullPanel11,"Student not found","Student Not Found!", 0);
					e1.printStackTrace();
				}
            }
        });

        submit3.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	AddDMFXConditionView adcv = new AddDMFXConditionView();
            	String dateOfExam2 = (String)monthOfExam2.getSelectedItem() +" " + (String)dayOfExam2.getSelectedItem()+", "+ yearOfExam2.getText();
            	if(dateOfExam2.length()>0){
            	// Date date = java.util.Calendar.getInstance().getTime();
            	//JComboBox tempLegendList74 = (JComboBox)e.getSource();
               /*
                *	int soundpermanent = 0;
	int decayedpermanent = 0;
	int missingpermanent = 0;
	int filledpermanent = 0;
	
	int temp =0;
	int soundtemp = 0;
	int decayedtemp = 0;
	int missingtemp = 0;
	int filledtemp = 0;
                */
            		
            		String tooth75status = (String) tempLegendList75.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),75,tooth75status, dateOfExam2);
					if(tooth75status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth75status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth75status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth75status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth74status = (String)tempLegendList74.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),74,tooth74status,dateOfExam2);
					if(tooth74status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth74status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth74status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth74status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth73status = (String)tempLegendList73.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),73,tooth73status,dateOfExam2);
					if(tooth73status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth73status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth73status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth73status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth72status = (String)tempLegendList72.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),72,tooth72status,dateOfExam2);
					if(tooth72status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth72status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth72status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth72status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth71status = (String)tempLegendList71.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),71,tooth71status,dateOfExam2);
					if(tooth71status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth71status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth71status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth71status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                //updateLabel(petName);
                String tooth85status = (String)tempLegendList85.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),85,tooth85status,dateOfExam2);
					if(tooth85status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth85status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth85status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth85status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth84status = (String)tempLegendList84.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),84,tooth84status,dateOfExam2);
					if(tooth84status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth84status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth84status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth84status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth83status = (String)tempLegendList83.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),83,tooth83status,dateOfExam2);
					if(tooth83status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth83status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth83status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth83status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth82status = (String)tempLegendList82.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),82,tooth82status,dateOfExam2);
					if(tooth82status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth82status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth82status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth82status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                String tooth81status = (String)tempLegendList81.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),81,tooth81status,dateOfExam2);
					if(tooth81status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth81status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth81status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth81status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                //label
                String tooth55status = (String)tempLegendList55.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),55,tooth55status,dateOfExam2);
					if(tooth55status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth55status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth55status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth55status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth54status = (String)tempLegendList54.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),54,tooth54status,dateOfExam2);
					if(tooth54status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth54status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth54status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth54status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth53status = (String)tempLegendList53.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),53,tooth53status,dateOfExam2);
					if(tooth53status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth53status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth53status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth53status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth52status = (String)tempLegendList52.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),52,tooth52status,dateOfExam2);
					if(tooth52status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth52status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth52status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth52status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth51status = (String)tempLegendList51.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),51,tooth51status,dateOfExam2);
					if(tooth51status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth51status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth51status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth51status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                //label
                String tooth65status = (String)tempLegendList65.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),65,tooth65status,dateOfExam2);
					if(tooth65status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth65status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth65status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth65status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth64status = (String)tempLegendList64.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),64,tooth64status,dateOfExam2);
					if(tooth64status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth64status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth64status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth64status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth63status = (String)tempLegendList63.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),63,tooth63status,dateOfExam2);
					if(tooth63status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth63status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth63status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth63status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth62status = (String)tempLegendList62.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),62,tooth62status,dateOfExam2);
					if(tooth62status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth62status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth62status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth62status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth61status = (String)tempLegendList61.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),61,tooth61status,dateOfExam2);
					if(tooth61status.equals("/"))  {
						temp++;
						soundtemp++;
					}
	                else if(tooth61status.equals("d")) {
	                	temp++;
						decayedtemp++;
	                }
	                else if(tooth61status.equals("m")){
	                	temp++;
						missingtemp++;
	                }
	                else if(tooth61status.equals("f")) {
	                	temp++;
						filledtemp++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
              //label
                String tooth18status = (String)permLegendList18.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),18,tooth18status,dateOfExam2);
					if(tooth18status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth18status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth18status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth18status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth17status = (String)permLegendList17.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),17,tooth17status,dateOfExam2);
					if(tooth17status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth17status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth17status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth17status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth16status = (String)permLegendList16.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),16,tooth16status,dateOfExam2);
					if(tooth16status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth16status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth16status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth16status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth15status = (String)permLegendList15.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),15,tooth15status,dateOfExam2);
					if(tooth15status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth15status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth15status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth15status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth14status = (String)permLegendList14.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),14,tooth14status,dateOfExam2);
					if(tooth14status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth14status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth14status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth14status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth13status = (String)permLegendList13.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),13,tooth13status,dateOfExam2);
					if(tooth13status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth13status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth13status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth13status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth12status = (String)permLegendList12.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),12,tooth12status,dateOfExam2);
					if(tooth12status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth12status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth12status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth12status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth11status = (String)permLegendList11.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),11,tooth11status,dateOfExam2);
					if(tooth11status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth11status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth11status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth11status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
              //label
                String tooth28status = (String)permLegendList28.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),28,tooth28status,dateOfExam2);
					if(tooth28status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth28status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth28status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth28status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth27status = (String)permLegendList27.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),27,tooth27status,dateOfExam2);
					if(tooth27status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth27status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth27status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth27status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth26status = (String)permLegendList26.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),26,tooth26status,dateOfExam2);
					if(tooth26status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth26status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth26status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth26status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth25status = (String)permLegendList25.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),25,tooth25status,dateOfExam2);
					if(tooth25status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth25status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth25status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth25status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth24status = (String)permLegendList24.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),24,tooth24status,dateOfExam2);
					if(tooth24status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth24status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth24status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth24status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth23status = (String)permLegendList23.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),23,tooth23status,dateOfExam2);
					if(tooth23status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth23status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth23status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth23status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth22status = (String)permLegendList22.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),22,tooth22status,dateOfExam2);
					if(tooth22status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth22status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth22status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth22status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth21status = (String)permLegendList21.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),21,tooth21status,dateOfExam2);
					if(tooth21status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth21status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth21status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth21status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                //label
                String tooth38status = (String)permLegendList38.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),38,tooth38status,dateOfExam2);
					if(tooth38status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth38status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth38status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth38status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth37status = (String)permLegendList37.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),37,tooth37status,dateOfExam2);
					if(tooth37status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth37status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth37status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth37status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth36status = (String)permLegendList36.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),36,tooth36status,dateOfExam2);
					if(tooth36status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth36status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth36status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth36status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth35status = (String)permLegendList35.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),35,tooth35status,dateOfExam2);
					if(tooth35status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth35status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth35status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth35status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth34status = (String)permLegendList34.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),34,tooth34status,dateOfExam2);
					if(tooth34status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth34status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth34status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth34status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth33status = (String)permLegendList33.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),33,tooth33status,dateOfExam2);
					if(tooth33status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth33status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth33status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth33status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth32status = (String)permLegendList32.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),32,tooth32status,dateOfExam2);
					if(tooth32status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth32status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth32status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth32status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
                String tooth31status = (String)permLegendList31.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),31,tooth31status,dateOfExam2);
					if(tooth31status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth31status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth31status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth31status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
				//label
                String tooth48status = (String)permLegendList48.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),48,tooth48status,dateOfExam2);
					if(tooth48status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth48status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth48status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth48status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth47status = (String)permLegendList47.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),47,tooth47status,dateOfExam2);
					if(tooth47status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth47status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth47status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth47status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth46status = (String)permLegendList46.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),46,tooth46status,dateOfExam2);
					if(tooth46status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth46status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth46status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth46status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth45status = (String)permLegendList45.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),45,tooth45status,dateOfExam2);
					if(tooth45status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth45status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth45status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth45status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth44status = (String)permLegendList44.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),44,tooth44status,dateOfExam2);
					if(tooth44status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth44status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth44status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth44status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth43status = (String)permLegendList43.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),43,tooth43status,dateOfExam2);
					if(tooth43status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth43status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth43status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth43status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
                	// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth42status = (String)permLegendList42.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),42,tooth42status,dateOfExam2);
					if(tooth42status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth42status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth42status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth42status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
                } catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                
                String tooth41status = (String)permLegendList41.getSelectedItem();
                try {
					adcv.sendAddDMFXRequest(dmfx.getStudentID(),41,tooth41status,dateOfExam2);
					if(tooth41status.equals("-"))  {
						perm++;
						soundpermanent++;
					}
	                else if(tooth41status.equals("D")) {
	                	perm++;
	                	decayedpermanent++;
	                }
	                else if(tooth41status.equals("M")){
	                	perm++;
	                	 missingpermanent++;
	                }
	                else if(tooth41status.equals("F")) {
	                	perm++;
	                	filledpermanent++;
	                }
	                else {
	                	//do nothing
	                }
					JOptionPane.showMessageDialog( nullPanel11,"DMFX Record successfully Added","SUCCESS", 1);
					surnameSearch3.setText("");
          	      firstNameSearch3.setText("");
          	      midNameSearch3.setText("");
          	        
          	      
          	        
          		  
          	        monthOfExam2.setSelectedItem("");
          	        monthOfExam2.setEditable(false);
          	        monthOfExam2.setEnabled(false);
          	        dayOfExam2.setSelectedItem("");
          	        dayOfExam2.setEditable(false);
          	        dayOfExam2.setEnabled(false);
          	        yearOfExam2.setText("");
          	        yearOfExam2.setEditable(false);
          	        
          	        permLegendList18.setSelectedItem(" ");
                      permLegendList17.setSelectedItem(" ");
                      permLegendList16.setSelectedItem(" ");
                      permLegendList15.setSelectedItem(" ");
                      permLegendList14.setSelectedItem(" ");
                      permLegendList13.setSelectedItem(" ");
                      permLegendList12.setSelectedItem(" ");
                      permLegendList11.setSelectedItem(" ");
                      permLegendList21.setSelectedItem(" ");
                      permLegendList22.setSelectedItem(" ");
                      permLegendList23.setSelectedItem(" ");
                      permLegendList24.setSelectedItem(" ");
                      permLegendList25.setSelectedItem(" ");
                      permLegendList26.setSelectedItem(" ");
                      permLegendList27.setSelectedItem(" ");
                      permLegendList28.setSelectedItem(" ");
                      permLegendList48.setSelectedItem(" ");
                      permLegendList47.setSelectedItem(" ");
                      permLegendList46.setSelectedItem(" ");
                      permLegendList45.setSelectedItem(" ");
                      permLegendList44.setSelectedItem(" ");
                      permLegendList43.setSelectedItem(" ");
                      permLegendList42.setSelectedItem(" ");
                      permLegendList41.setSelectedItem(" ");
                      permLegendList31.setSelectedItem(" ");
                      permLegendList32.setSelectedItem(" ");
                      permLegendList33.setSelectedItem(" ");
                      permLegendList34.setSelectedItem(" ");
                      permLegendList35.setSelectedItem(" ");
                      permLegendList36.setSelectedItem(" ");
                      permLegendList37.setSelectedItem(" ");
                      permLegendList38.setSelectedItem(" ");
                      tempLegendList85.setSelectedItem(" ");
                      tempLegendList84.setSelectedItem(" ");
                      tempLegendList83.setSelectedItem(" ");
                      tempLegendList82.setSelectedItem(" ");
                      tempLegendList81.setSelectedItem(" ");
                      tempLegendList71.setSelectedItem(" ");
                      tempLegendList72.setSelectedItem(" ");
                      tempLegendList73.setSelectedItem(" ");
                      tempLegendList74.setSelectedItem(" ");
                      tempLegendList75.setSelectedItem(" ");
                      tempLegendList55.setSelectedItem(" ");
                      tempLegendList54.setSelectedItem(" ");
                      tempLegendList53.setSelectedItem(" ");
                      tempLegendList52.setSelectedItem(" ");
                      tempLegendList51.setSelectedItem(" ");
                      tempLegendList61.setSelectedItem(" ");
                      tempLegendList62.setSelectedItem(" ");
                      tempLegendList63.setSelectedItem(" ");
                      tempLegendList64.setSelectedItem(" ");
                      tempLegendList65.setSelectedItem(" ");

          	        permLegendList18.setEnabled(false);
                      permLegendList17.setEnabled(false);
                      permLegendList16.setEnabled(false);
                      permLegendList15.setEnabled(false);
                      permLegendList14.setEnabled(false);
                      permLegendList13.setEnabled(false);
                      permLegendList12.setEnabled(false);
                      permLegendList11.setEnabled(false);
                      permLegendList21.setEnabled(false);
                      permLegendList22.setEnabled(false);
                      permLegendList23.setEnabled(false);
                      permLegendList24.setEnabled(false);
                      permLegendList25.setEnabled(false);
                      permLegendList26.setEnabled(false);
                      permLegendList27.setEnabled(false);
                      permLegendList28.setEnabled(false);
                      permLegendList48.setEnabled(false);
                      permLegendList47.setEnabled(false);
                      permLegendList46.setEnabled(false);
                      permLegendList45.setEnabled(false);
                      permLegendList44.setEnabled(false);
                      permLegendList43.setEnabled(false);
                      permLegendList42.setEnabled(false);
                      permLegendList41.setEnabled(false);
                      permLegendList31.setEnabled(false);
                      permLegendList32.setEnabled(false);
                      permLegendList33.setEnabled(false);
                      permLegendList34.setEnabled(false);
                      permLegendList35.setEnabled(false);
                      permLegendList36.setEnabled(false);
                      permLegendList37.setEnabled(false);
                      permLegendList38.setEnabled(false);
                      tempLegendList85.setEnabled(false);
                      tempLegendList84.setEnabled(false);
                      tempLegendList83.setEnabled(false);
                      tempLegendList82.setEnabled(false);
                      tempLegendList81.setEnabled(false);
                      tempLegendList71.setEnabled(false);
                      tempLegendList72.setEnabled(false);
                      tempLegendList73.setEnabled(false);
                      tempLegendList74.setEnabled(false);
                      tempLegendList75.setEnabled(false);
                      tempLegendList55.setEnabled(false);
                      tempLegendList54.setEnabled(false);
                      tempLegendList53.setEnabled(false);
                      tempLegendList52.setEnabled(false);
                      tempLegendList51.setEnabled(false);
                      tempLegendList61.setEnabled(false);
                      tempLegendList62.setEnabled(false);
                      tempLegendList63.setEnabled(false);
                      tempLegendList64.setEnabled(false);
                      tempLegendList65.setEnabled(false);
                    	submit3.setEnabled(false);
                    	
                    	TotalPeer.createSummary(dmfx.getStudentID(), perm, 
                  	  			soundpermanent,
                  				decayedpermanent,
                  				missingpermanent,
                  				filledpermanent,
                  				(decayedpermanent+missingpermanent+filledpermanent),
                  				temp,
                  				soundtemp,
                  				decayedtemp,
                  				filledtemp,
                  				(decayedtemp+missingtemp+filledtemp), dateOfExam2);
                  	      
                  	      perm = 0;  
                  	      soundpermanent = 0;
                  	      decayedpermanent = 0;
                  	      missingpermanent = 0;
                  	      filledpermanent = 0;
                  		
                  	      temp =0;
                  	      soundtemp = 0;
                  	      decayedtemp = 0;
                  	      missingtemp = 0;
                  		  filledtemp = 0;

				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            	}
            	else
            		JOptionPane.showMessageDialog( nullPanel11,"Please Enter date","ERROR!", 0);
				
            	
            }
        });
        reset3.addActionListener(new ActionListener() {
        	public void actionPerformed(ActionEvent e) {
            	
            	  try {
            		  surnameSearch3.setText("");
            	      firstNameSearch3.setText("");
            	      midNameSearch3.setText("");
            	        
            	        
            	        monthOfExam2.setSelectedItem("");
            	        monthOfExam2.setEditable(false);
            	        monthOfExam2.setEnabled(false);
            	        dayOfExam2.setSelectedItem("");
            	        dayOfExam2.setEditable(false);
            	        dayOfExam2.setEnabled(false);
            	        yearOfExam2.setText("");
            	        yearOfExam2.setEditable(false);
            	        
            	        permLegendList18.setSelectedItem(" ");
                        permLegendList17.setSelectedItem(" ");
                        permLegendList16.setSelectedItem(" ");
                        permLegendList15.setSelectedItem(" ");
                        permLegendList14.setSelectedItem(" ");
                        permLegendList13.setSelectedItem(" ");
                        permLegendList12.setSelectedItem(" ");
                        permLegendList11.setSelectedItem(" ");
                        permLegendList21.setSelectedItem(" ");
                        permLegendList22.setSelectedItem(" ");
                        permLegendList23.setSelectedItem(" ");
                        permLegendList24.setSelectedItem(" ");
                        permLegendList25.setSelectedItem(" ");
                        permLegendList26.setSelectedItem(" ");
                        permLegendList27.setSelectedItem(" ");
                        permLegendList28.setSelectedItem(" ");
                        permLegendList48.setSelectedItem(" ");
                        permLegendList47.setSelectedItem(" ");
                        permLegendList46.setSelectedItem(" ");
                        permLegendList45.setSelectedItem(" ");
                        permLegendList44.setSelectedItem(" ");
                        permLegendList43.setSelectedItem(" ");
                        permLegendList42.setSelectedItem(" ");
                        permLegendList41.setSelectedItem(" ");
                        permLegendList31.setSelectedItem(" ");
                        permLegendList32.setSelectedItem(" ");
                        permLegendList33.setSelectedItem(" ");
                        permLegendList34.setSelectedItem(" ");
                        permLegendList35.setSelectedItem(" ");
                        permLegendList36.setSelectedItem(" ");
                        permLegendList37.setSelectedItem(" ");
                        permLegendList38.setSelectedItem(" ");
                        tempLegendList85.setSelectedItem(" ");
                        tempLegendList84.setSelectedItem(" ");
                        tempLegendList83.setSelectedItem(" ");
                        tempLegendList82.setSelectedItem(" ");
                        tempLegendList81.setSelectedItem(" ");
                        tempLegendList71.setSelectedItem(" ");
                        tempLegendList72.setSelectedItem(" ");
                        tempLegendList73.setSelectedItem(" ");
                        tempLegendList74.setSelectedItem(" ");
                        tempLegendList75.setSelectedItem(" ");
                        tempLegendList55.setSelectedItem(" ");
                        tempLegendList54.setSelectedItem(" ");
                        tempLegendList53.setSelectedItem(" ");
                        tempLegendList52.setSelectedItem(" ");
                        tempLegendList51.setSelectedItem(" ");
                        tempLegendList61.setSelectedItem(" ");
                        tempLegendList62.setSelectedItem(" ");
                        tempLegendList63.setSelectedItem(" ");
                        tempLegendList64.setSelectedItem(" ");
                        tempLegendList65.setSelectedItem(" ");

            	        permLegendList18.setEnabled(false);
                        permLegendList17.setEnabled(false);
                        permLegendList16.setEnabled(false);
                        permLegendList15.setEnabled(false);
                        permLegendList14.setEnabled(false);
                        permLegendList13.setEnabled(false);
                        permLegendList12.setEnabled(false);
                        permLegendList11.setEnabled(false);
                        permLegendList21.setEnabled(false);
                        permLegendList22.setEnabled(false);
                        permLegendList23.setEnabled(false);
                        permLegendList24.setEnabled(false);
                        permLegendList25.setEnabled(false);
                        permLegendList26.setEnabled(false);
                        permLegendList27.setEnabled(false);
                        permLegendList28.setEnabled(false);
                        permLegendList48.setEnabled(false);
                        permLegendList47.setEnabled(false);
                        permLegendList46.setEnabled(false);
                        permLegendList45.setEnabled(false);
                        permLegendList44.setEnabled(false);
                        permLegendList43.setEnabled(false);
                        permLegendList42.setEnabled(false);
                        permLegendList41.setEnabled(false);
                        permLegendList31.setEnabled(false);
                        permLegendList32.setEnabled(false);
                        permLegendList33.setEnabled(false);
                        permLegendList34.setEnabled(false);
                        permLegendList35.setEnabled(false);
                        permLegendList36.setEnabled(false);
                        permLegendList37.setEnabled(false);
                        permLegendList38.setEnabled(false);
                        tempLegendList85.setEnabled(false);
                        tempLegendList84.setEnabled(false);
                        tempLegendList83.setEnabled(false);
                        tempLegendList82.setEnabled(false);
                        tempLegendList81.setEnabled(false);
                        tempLegendList71.setEnabled(false);
                        tempLegendList72.setEnabled(false);
                        tempLegendList73.setEnabled(false);
                        tempLegendList74.setEnabled(false);
                        tempLegendList75.setEnabled(false);
                        tempLegendList55.setEnabled(false);
                        tempLegendList54.setEnabled(false);
                        tempLegendList53.setEnabled(false);
                        tempLegendList52.setEnabled(false);
                        tempLegendList51.setEnabled(false);
                        tempLegendList61.setEnabled(false);
                        tempLegendList62.setEnabled(false);
                        tempLegendList63.setEnabled(false);
                        tempLegendList64.setEnabled(false);
                        tempLegendList65.setEnabled(false);
                      	submit3.setEnabled(false);
                	
            	       
            		  
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            }
        });

/*--------------------------------------------------------------------------*/
 /*--------------------------------------------------------------------------*/
 /*-----------------panels for add DMFX condition----------------------*/        
        JPanel nullPanel17 = new JPanel();
        final JPanel nullPanel18 = new JPanel();
        JPanel nullPanel19 = new JPanel();
        JPanel nullPanel20 = new JPanel();
        JPanel nullPanel21 = new JPanel();
        JPanel nullPanel22 = new JPanel();
        JPanel nullPanel23 = new JPanel();
        JPanel addServicesPanel = new JPanel(new GridLayout(20,0));
        JPanel searchPanel4 = new JPanel(new FlowLayout());
        JPanel buttonsPanel4 = new JPanel(new FlowLayout());
        JPanel servicePanel1 = new JPanel(new FlowLayout());
        JPanel servicePanel2 = new JPanel(new FlowLayout());
        JPanel servicePanel3 = new JPanel(new FlowLayout());
        JPanel servicePanel4 = new JPanel(new FlowLayout());
        JPanel servicePanel5 = new JPanel(new FlowLayout());
        JPanel serviceLabelPanel2 = new JPanel(new FlowLayout());
        JPanel serviceLabelPanel3 = new JPanel(new FlowLayout());
        JPanel serviceLabelPanel4 = new JPanel(new FlowLayout());
        JPanel serviceLabelPanel5 = new JPanel(new FlowLayout());

        /*-----------------text fields for add DMFX condition----------------------*/

        final JTextField surnameSearch4 = new JTextField(20);
        final JTextField firstNameSearch4 = new JTextField(20);
        final JTextField midNameSearch4 = new JTextField(3);

/*-----------------labels for add services rendered----------------------*/

        JLabel surnameLabel4 = new JLabel("Surname : ");
        JLabel firstNameLabel4 = new JLabel("First Name : ");
        JLabel midNameLabel4 = new JLabel("MI : ");
        
        JLabel tempServices1Label = new JLabel
        ("55            54            53           52 " +
        		"          51           61           62          63           64             65");
        
        JLabel tempServices2Label = new JLabel
        ("85            84            83           82 " +
		"          81           71           72          73           74             75");
        
        JLabel permServices1Label = new JLabel
        ("18            17             16          15 " +
        "          14          13            12             11" +
        "            21           22            23           24" +
        "           25            26            27            28");
        
        JLabel permServices2Label = new JLabel
        ("48            47             46          45 " +
        "          44          43            42             41" +
        "            31           32            33           34" +
        "           35            36            37            38");
        
        JLabel currentDateLabel3 = new JLabel("Date of Oral Examination : ");
        JLabel currentMonthLabel3 = new JLabel("Month : ");
        JLabel currentDayLabel3 = new JLabel("Day : ");
        JLabel currentYearLabel3 = new JLabel("Year : ");
        
        final JComboBox monthOfExam3 = new JComboBox(monthSelect);
        monthOfExam3.setEditable(false);
        monthOfExam3.setEnabled(false);
        
        //gawing spinner
        final JComboBox dayOfExam3 = new JComboBox(daySelect);
        dayOfExam3.setEditable(false);
        dayOfExam3.setEnabled(false);
        
        //gawing spinner
        final JTextField yearOfExam3 = new JTextField(6);
        yearOfExam3.setEnabled(false);
        yearOfExam3.setEnabled(false);
        
        
/*-----------------buttons for add services rendered----------------------*/
        
        final JButton submit4 = new JButton("Add Services Renderded");
		JButton reset4 = new JButton("Reset");
		JButton search4 = new JButton("Search");

/*-----------------layouting for add services rendered----------------------*/
        addServicesPanel.add(nullPanel17);
        
        searchPanel4.add(surnameLabel4);
        searchPanel4.add(surnameSearch4);
        searchPanel4.add(firstNameLabel4);
        searchPanel4.add(firstNameSearch4);
        searchPanel4.add(midNameLabel4);
        searchPanel4.add(midNameSearch4);
        searchPanel4.add(search4);
        
        addServicesPanel.add(searchPanel4);
        addServicesPanel.add(nullPanel18);

        servicePanel1.add(currentDateLabel3);
        servicePanel1.add(currentMonthLabel3);
        servicePanel1.add(monthOfExam3);
        servicePanel1.add(currentDayLabel3);
        servicePanel1.add(dayOfExam3);
        servicePanel1.add(currentYearLabel3);
        servicePanel1.add(yearOfExam3);
        
        addServicesPanel.add(servicePanel1);
        addServicesPanel.add(nullPanel19);
        
        
        String[] legend = {" ","S","PF","TF","X","O"};

        final JComboBox legendList55 = new JComboBox(legend);
        legendList55.setEditable(false);
        legendList55.setEnabled(false);
        servicePanel2.add(legendList55);
        
        final JComboBox legendList54 = new JComboBox(legend);
        legendList54.setEditable(false);
        legendList54.setEnabled(false);
        servicePanel2.add(legendList54);
        
        final JComboBox legendList53 = new JComboBox(legend);
        legendList53.setEditable(false);
        legendList53.setEnabled(false);
        servicePanel2.add(legendList53);
        
        final JComboBox legendList52 = new JComboBox(legend);
        legendList52.setEditable(false);
        legendList52.setEnabled(false);
        servicePanel2.add(legendList52);
        
        final JComboBox legendList51 = new JComboBox(legend);
        legendList51.setEditable(false);
        legendList51.setEnabled(false);
        servicePanel2.add(legendList51);
        
        final JComboBox legendList61 = new JComboBox(legend);
        legendList61.setEditable(false);
        legendList61.setEnabled(false);
        servicePanel2.add(legendList61);
        
        final JComboBox legendList62 = new JComboBox(legend);
        legendList62.setEditable(false);
        legendList62.setEnabled(false);
        servicePanel2.add(legendList62);
        
        final JComboBox legendList63 = new JComboBox(legend);
        legendList63.setEditable(false);
        legendList63.setEnabled(false);
        servicePanel2.add(legendList63);
        
        final JComboBox legendList64 = new JComboBox(legend);
        legendList64.setEditable(false);
        legendList64.setEnabled(false);
        servicePanel2.add(legendList64);
        
        final JComboBox legendList65 = new JComboBox(legend);
        legendList65.setEditable(false);
        legendList65.setEnabled(false);
        servicePanel2.add(legendList65);
        
        /*----------*/
        addServicesPanel.add(servicePanel2);
        serviceLabelPanel2.add(tempServices1Label);
        addServicesPanel.add(serviceLabelPanel2);
        addServicesPanel.add(nullPanel20);
        /*----------*/
        
        final JComboBox legendList85 = new JComboBox(legend);
        legendList85.setEditable(false);
        legendList85.setEnabled(false);
        servicePanel3.add(legendList85);
        
        final JComboBox legendList84 = new JComboBox(legend);
        legendList84.setEditable(false);
        legendList84.setEnabled(false);
        servicePanel3.add(legendList84);
        
        final JComboBox legendList83 = new JComboBox(legend);
        legendList83.setEditable(false);
        legendList83.setEnabled(false);
        servicePanel3.add(legendList83);
        
        final JComboBox legendList82 = new JComboBox(legend);
        legendList82.setEditable(false);
        legendList82.setEnabled(false);
        servicePanel3.add(legendList82);
        
        final JComboBox legendList81 = new JComboBox(legend);
        legendList81.setEditable(false);
        legendList81.setEnabled(false);
        servicePanel3.add(legendList81);
        
        final JComboBox legendList71 = new JComboBox(legend);
        legendList71.setEditable(false);
        legendList71.setEnabled(false);
        servicePanel3.add(legendList71);
        
        final JComboBox legendList72 = new JComboBox(legend);
        legendList72.setEditable(false);
        legendList72.setEnabled(false);
        servicePanel3.add(legendList72);
        
        final JComboBox legendList73 = new JComboBox(legend);
        legendList73.setEditable(false);
        legendList73.setEnabled(false);
        servicePanel3.add(legendList73);
        
        final JComboBox legendList74 = new JComboBox(legend);
        legendList74.setEditable(false);
        legendList74.setEnabled(false);
        servicePanel3.add(legendList74);
        
        final JComboBox legendList75 = new JComboBox(legend);
        legendList75.setEditable(false);
        legendList75.setEnabled(false);
        servicePanel3.add(legendList75);
        
        /*----------*/
        addServicesPanel.add(servicePanel3);
        serviceLabelPanel3.add(tempServices2Label);
        addServicesPanel.add(serviceLabelPanel3);
        addServicesPanel.add(nullPanel21);
        /*----------*/
        
        final JComboBox legendList18 = new JComboBox(legend);
        legendList18.setEditable(false);
        legendList18.setEnabled(false);
        servicePanel4.add(legendList18);
        
        final JComboBox legendList17 = new JComboBox(legend);
        legendList17.setEditable(false);
        legendList17.setEnabled(false);
        servicePanel4.add(legendList17);
        
        final JComboBox legendList16 = new JComboBox(legend);
        legendList16.setEditable(false);
        legendList16.setEnabled(false);
        servicePanel4.add(legendList16);
        
        final JComboBox legendList15 = new JComboBox(legend);
        legendList15.setEditable(false);
        legendList15.setEnabled(false);
        servicePanel4.add(legendList15);
        
        final JComboBox legendList14 = new JComboBox(legend);
        legendList14.setEditable(false);
        legendList14.setEnabled(false);
        servicePanel4.add(legendList14);
        
        final JComboBox legendList13 = new JComboBox(legend);
        legendList13.setEditable(false);
        legendList13.setEnabled(false);
        servicePanel4.add(legendList13);
        
        final JComboBox legendList12 = new JComboBox(legend);
        legendList12.setEditable(false);
        legendList12.setEnabled(false);
        servicePanel4.add(legendList12);
        
        final JComboBox legendList11 = new JComboBox(legend);
        legendList11.setEditable(false);
        legendList11.setEnabled(false);
        servicePanel4.add(legendList11);
        
        final JComboBox legendList21 = new JComboBox(legend);
        legendList21.setEditable(false);
        legendList21.setEnabled(false);
        servicePanel4.add(legendList21);
        
        final JComboBox legendList22 = new JComboBox(legend);
        legendList22.setEditable(false);
        legendList22.setEnabled(false);
        servicePanel4.add(legendList22);
        
        final JComboBox legendList23 = new JComboBox(legend);
        legendList23.setEditable(false);
        legendList23.setEnabled(false);
        servicePanel4.add(legendList23);
        
        final JComboBox legendList24 = new JComboBox(legend);
        legendList24.setEditable(false);
        legendList24.setEnabled(false);
        servicePanel4.add(legendList24);
        
        final JComboBox legendList25 = new JComboBox(legend);
        legendList25.setEditable(false);
        legendList25.setEnabled(false);
        servicePanel4.add(legendList25);
        
        final JComboBox legendList26 = new JComboBox(legend);
        legendList26.setEditable(false);
        legendList26.setEnabled(false);
        servicePanel4.add(legendList26);
        
        final JComboBox legendList27 = new JComboBox(legend);
        legendList27.setEditable(false);
        legendList27.setEnabled(false);
        servicePanel4.add(legendList27);
        
        final JComboBox legendList28 = new JComboBox(legend);
        legendList28.setEditable(false);
        legendList28.setEnabled(false);
        servicePanel4.add(legendList28);
        
        /*----------*/
        addServicesPanel.add(servicePanel4);
        serviceLabelPanel4.add(permServices1Label);
        addServicesPanel.add(serviceLabelPanel4);
        addServicesPanel.add(nullPanel22);
        /*----------*/

        final JComboBox legendList48 = new JComboBox(legend);
        legendList48.setEditable(false);
        legendList48.setEnabled(false);
        servicePanel5.add(legendList48);
        
        final JComboBox legendList47 = new JComboBox(legend);
        legendList47.setEditable(false);
        legendList47.setEnabled(false);
        servicePanel5.add(legendList47);
        
        final JComboBox legendList46 = new JComboBox(legend);
        legendList46.setEditable(false);
        legendList46.setEnabled(false);
        servicePanel5.add(legendList46);
        
        final JComboBox legendList45 = new JComboBox(legend);
        legendList45.setEditable(false);
        legendList45.setEnabled(false);
        servicePanel5.add(legendList45);
        
        final JComboBox legendList44 = new JComboBox(legend);
        legendList44.setEditable(false);
        legendList44.setEnabled(false);
        servicePanel5.add(legendList44);
        
        final JComboBox legendList43 = new JComboBox(legend);
        legendList43.setEditable(false);
        legendList43.setEnabled(false);
        servicePanel5.add(legendList43);
        
        final JComboBox legendList42 = new JComboBox(legend);
        legendList42.setEditable(false);
        legendList42.setEnabled(false);
        servicePanel5.add(legendList42);
        
        final JComboBox legendList41 = new JComboBox(legend);
        legendList41.setEditable(false);
        legendList41.setEnabled(false);
        servicePanel5.add(legendList41);
        
        
        final JComboBox legendList31 = new JComboBox(legend);
        legendList31.setEditable(false);
        legendList31.setEnabled(false);
        servicePanel5.add(legendList31);
        
        final JComboBox legendList32 = new JComboBox(legend);
        legendList32.setEditable(false);
        legendList32.setEnabled(false);
        servicePanel5.add(legendList32);
        
        final JComboBox legendList33 = new JComboBox(legend);
        legendList33.setEditable(false);
        legendList33.setEnabled(false);
        servicePanel5.add(legendList33);
        
        final JComboBox legendList34 = new JComboBox(legend);
        legendList34.setEditable(false);
        legendList34.setEnabled(false);
        servicePanel5.add(legendList34);
        
        final JComboBox legendList35 = new JComboBox(legend);
        legendList35.setEditable(false);
        legendList35.setEnabled(false);
        servicePanel5.add(legendList35);
        
        final JComboBox legendList36 = new JComboBox(legend);
        legendList36.setEditable(false);
        legendList36.setEnabled(false);
        servicePanel5.add(legendList36);
        
        final JComboBox legendList37 = new JComboBox(legend);
        legendList37.setEditable(false);
        legendList37.setEnabled(false);
        servicePanel5.add(legendList37);
        
        final JComboBox legendList38 = new JComboBox(legend);
        legendList38.setEditable(false);
        legendList38.setEnabled(false);
        servicePanel5.add(legendList38);
        
        /*----------*/
        addServicesPanel.add(servicePanel5);
        serviceLabelPanel5.add(permServices2Label);
        addServicesPanel.add(serviceLabelPanel5);
        addServicesPanel.add(nullPanel23);
        /*----------*/

        JLabel remarksLabel = new JLabel("Remarks : ");
        final JTextField remarks = new JTextField(30);
        JPanel remarksPanel = new JPanel(new FlowLayout());
        JPanel nullPanelX = new JPanel();
        
        remarksPanel.add(remarksLabel);
        remarksPanel.add(remarks);
        remarks.setEnabled(false);
        
        addServicesPanel.add(remarksPanel);
        
        buttonsPanel4.add(submit4);
        submit4.setEnabled(false);
        buttonsPanel4.add(reset4);

        addServicesPanel.add(buttonsPanel4);
        
                tabbedPane.addTab("Add Services Rendered", tooth01, addServicesPanel,
                "Click this tab to add services rendered");
        tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);


        search4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	String sur = " ";
            	String fN = " ";
            	String mI = " ";
            	String sur2 = " ";
            	String fN2 = " ";
            	String mI2 = " ";
            	
            	String surname = surnameSearch4.getText();
              	String firstname = firstNameSearch4.getText();
              	String mi = midNameSearch4.getText();
                SearchView search = new SearchView();

            	
            	
            
                
                try {ohs = search.search(surname,firstname,mi);
            	sur = ohs.getSurname();
            	fN = ohs.getFirstname();
            	mI = ohs.getMi();
            	sur2 = sur.toLowerCase();
            	fN2 = fN.toLowerCase();
            	mI2 = mI.toLowerCase();
            	surname = surname.toLowerCase();
              	firstname = firstname.toLowerCase();
              	mi = mi.toLowerCase();
            
                	if((surname.length()==0)||(firstname.length()==0)||(mi.length()==0)){
                		JOptionPane.showMessageDialog( nullPanel18,"Missing Inputs","ERROR!", 0);	
                	}
                	else if (surname.equals(sur2)&&firstname.equals(fN2)&&mi.equals(mI2)){
                		JOptionPane.showMessageDialog( nullPanel18, fN+ " " + mI+ " " + sur + " found","Student Found", 1);

                		
        	        monthOfExam3.setSelectedItem("");
        	        monthOfExam3.setEditable(false);
        	        monthOfExam3.setEnabled(false);
        	        dayOfExam3.setSelectedItem("");
        	        dayOfExam3.setEditable(false);
        	        dayOfExam3.setEnabled(false);
        	        yearOfExam3.setText("");
        	        yearOfExam3.setEditable(false);
        	    
        		
        		legendList55.setSelectedItem(" ");
                legendList54.setSelectedItem(" ");
                legendList53.setSelectedItem(" ");
                legendList52.setSelectedItem(" ");
                legendList51.setSelectedItem(" ");
                legendList61.setSelectedItem(" ");
                legendList62.setSelectedItem(" ");
                legendList63.setSelectedItem(" ");
                legendList64.setSelectedItem(" ");
                legendList65.setSelectedItem(" ");
                legendList85.setSelectedItem(" ");
                legendList84.setSelectedItem(" ");
                legendList83.setSelectedItem(" ");
                legendList82.setSelectedItem(" ");
                legendList81.setSelectedItem(" ");
                legendList71.setSelectedItem(" ");
                legendList72.setSelectedItem(" ");
                legendList73.setSelectedItem(" ");
                legendList74.setSelectedItem(" ");
                legendList75.setSelectedItem(" ");
                legendList18.setSelectedItem(" ");
                legendList17.setSelectedItem(" ");
                legendList16.setSelectedItem(" ");
                legendList15.setSelectedItem(" ");
                legendList14.setSelectedItem(" ");
                legendList13.setSelectedItem(" ");
                legendList12.setSelectedItem(" ");
                legendList11.setSelectedItem(" ");
                legendList21.setSelectedItem(" ");
                legendList22.setSelectedItem(" ");
                legendList23.setSelectedItem(" ");
                legendList24.setSelectedItem(" ");
                legendList25.setSelectedItem(" ");
                legendList26.setSelectedItem(" ");
                legendList27.setSelectedItem(" ");
                legendList28.setSelectedItem(" ");
                legendList48.setSelectedItem(" ");
                legendList47.setSelectedItem(" ");
                legendList46.setSelectedItem(" ");
                legendList45.setSelectedItem(" ");
                legendList44.setSelectedItem(" ");
                legendList43.setSelectedItem(" ");
                legendList42.setSelectedItem(" ");
                legendList41.setSelectedItem(" ");
                legendList31.setSelectedItem(" ");
                legendList32.setSelectedItem(" ");
                legendList33.setSelectedItem(" ");
                legendList34.setSelectedItem(" ");
                legendList35.setSelectedItem(" ");
                legendList36.setSelectedItem(" ");
                legendList37.setSelectedItem(" ");
                legendList38.setSelectedItem(" ");
        		remarks.setText(" ");
        		
        		legendList55.setEnabled(false);
                legendList54.setEnabled(false);
                legendList53.setEnabled(false);
                legendList52.setEnabled(false);
                legendList51.setEnabled(false);
                legendList61.setEnabled(false);
                legendList62.setEnabled(false);
                legendList63.setEnabled(false);
                legendList64.setEnabled(false);
                legendList65.setEnabled(false);
                legendList85.setEnabled(false);
                legendList84.setEnabled(false);
                legendList83.setEnabled(false);
                legendList82.setEnabled(false);
                legendList81.setEnabled(false);
                legendList71.setEnabled(false);
                legendList72.setEnabled(false);
                legendList73.setEnabled(false);
                legendList74.setEnabled(false);
                legendList75.setEnabled(false);
                legendList18.setEnabled(false);
                legendList17.setEnabled(false);
                legendList16.setEnabled(false);
                legendList15.setEnabled(false);
                legendList14.setEnabled(false);
                legendList13.setEnabled(false);
                legendList12.setEnabled(false);
                legendList11.setEnabled(false);
                legendList21.setEnabled(false);
                legendList22.setEnabled(false);
                legendList23.setEnabled(false);
                legendList24.setEnabled(false);
                legendList25.setEnabled(false);
                legendList26.setEnabled(false);
                legendList27.setEnabled(false);
                legendList28.setEnabled(false);
                legendList48.setEnabled(false);
                legendList47.setEnabled(false);
                legendList46.setEnabled(false);
                legendList45.setEnabled(false);
                legendList44.setEnabled(false);
                legendList43.setEnabled(false);
                legendList42.setEnabled(false);
                legendList41.setEnabled(false);
                legendList31.setEnabled(false);
                legendList32.setEnabled(false);
                legendList33.setEnabled(false);
                legendList34.setEnabled(false);
                legendList35.setEnabled(false);
                legendList36.setEnabled(false);
                legendList37.setEnabled(false);
                legendList38.setEnabled(false);
                remarks.setEnabled(false);
                submit4.setEnabled(false);

                	
                    monthOfExam3.setEnabled(true);
        	        dayOfExam3.setEnabled(true);
        	        yearOfExam3.setEditable(true);
        	        yearOfExam3.setEnabled(true);
                	
                	legendList55.setEnabled(true);
                    legendList54.setEnabled(true);
                    legendList53.setEnabled(true);
                    legendList52.setEnabled(true);
                    legendList51.setEnabled(true);
                    legendList61.setEnabled(true);
                    legendList62.setEnabled(true);
                    legendList63.setEnabled(true);
                    legendList64.setEnabled(true);
                    legendList65.setEnabled(true);
                    legendList85.setEnabled(true);
                    legendList84.setEnabled(true);
                    legendList83.setEnabled(true);
                    legendList82.setEnabled(true);
                    legendList81.setEnabled(true);
                    legendList71.setEnabled(true);
                    legendList72.setEnabled(true);
                    legendList73.setEnabled(true);
                    legendList74.setEnabled(true);
                    legendList75.setEnabled(true);
                    legendList18.setEnabled(true);
                    legendList17.setEnabled(true);
                    legendList16.setEnabled(true);
                    legendList15.setEnabled(true);
                    legendList14.setEnabled(true);
                    legendList13.setEnabled(true);
                    legendList12.setEnabled(true);
                    legendList11.setEnabled(true);
                    legendList21.setEnabled(true);
                    legendList22.setEnabled(true);
                    legendList23.setEnabled(true);
                    legendList24.setEnabled(true);
                    legendList25.setEnabled(true);
                    legendList26.setEnabled(true);
                    legendList27.setEnabled(true);
                    legendList28.setEnabled(true);
                    legendList48.setEnabled(true);
                    legendList47.setEnabled(true);
                    legendList46.setEnabled(true);
                    legendList45.setEnabled(true);
                    legendList44.setEnabled(true);
                    legendList43.setEnabled(true);
                    legendList42.setEnabled(true);
                    legendList41.setEnabled(true);
                    legendList31.setEnabled(true);
                    legendList32.setEnabled(true);
                    legendList33.setEnabled(true);
                    legendList34.setEnabled(true);
                    legendList35.setEnabled(true);
                    legendList36.setEnabled(true);
                    legendList37.setEnabled(true);
                    legendList38.setEnabled(true);
                    remarks.setEnabled(true);
                    submit4.setEnabled(true);

            			
                	}
                	else{
                		JOptionPane.showMessageDialog( nullPanel18,"Missing Inputs","ERROR!", 0);	
                    		
                	}
					
				} catch (Exception e1) {
					JOptionPane.showMessageDialog( nullPanel18,"Missing Inputs","ERROR!", 0);	
                	// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            }
        }); 
        
        reset4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	try {
            		  surnameSearch4.setText("");
            	      firstNameSearch4.setText("");
            	      midNameSearch4.setText("");
            	        
            	        
            	        monthOfExam3.setSelectedItem("");
            	        monthOfExam3.setEditable(false);
            	        monthOfExam3.setEnabled(false);
            	        dayOfExam3.setSelectedItem("");
            	        dayOfExam3.setEditable(false);
            	        dayOfExam3.setEnabled(false);
            	        yearOfExam3.setText("");
            	        yearOfExam3.setEditable(false);
            	    
            		
            		legendList55.setSelectedItem(" ");
                    legendList54.setSelectedItem(" ");
                    legendList53.setSelectedItem(" ");
                    legendList52.setSelectedItem(" ");
                    legendList51.setSelectedItem(" ");
                    legendList61.setSelectedItem(" ");
                    legendList62.setSelectedItem(" ");
                    legendList63.setSelectedItem(" ");
                    legendList64.setSelectedItem(" ");
                    legendList65.setSelectedItem(" ");
                    legendList85.setSelectedItem(" ");
                    legendList84.setSelectedItem(" ");
                    legendList83.setSelectedItem(" ");
                    legendList82.setSelectedItem(" ");
                    legendList81.setSelectedItem(" ");
                    legendList71.setSelectedItem(" ");
                    legendList72.setSelectedItem(" ");
                    legendList73.setSelectedItem(" ");
                    legendList74.setSelectedItem(" ");
                    legendList75.setSelectedItem(" ");
                    legendList18.setSelectedItem(" ");
                    legendList17.setSelectedItem(" ");
                    legendList16.setSelectedItem(" ");
                    legendList15.setSelectedItem(" ");
                    legendList14.setSelectedItem(" ");
                    legendList13.setSelectedItem(" ");
                    legendList12.setSelectedItem(" ");
                    legendList11.setSelectedItem(" ");
                    legendList21.setSelectedItem(" ");
                    legendList22.setSelectedItem(" ");
                    legendList23.setSelectedItem(" ");
                    legendList24.setSelectedItem(" ");
                    legendList25.setSelectedItem(" ");
                    legendList26.setSelectedItem(" ");
                    legendList27.setSelectedItem(" ");
                    legendList28.setSelectedItem(" ");
                    legendList48.setSelectedItem(" ");
                    legendList47.setSelectedItem(" ");
                    legendList46.setSelectedItem(" ");
                    legendList45.setSelectedItem(" ");
                    legendList44.setSelectedItem(" ");
                    legendList43.setSelectedItem(" ");
                    legendList42.setSelectedItem(" ");
                    legendList41.setSelectedItem(" ");
                    legendList31.setSelectedItem(" ");
                    legendList32.setSelectedItem(" ");
                    legendList33.setSelectedItem(" ");
                    legendList34.setSelectedItem(" ");
                    legendList35.setSelectedItem(" ");
                    legendList36.setSelectedItem(" ");
                    legendList37.setSelectedItem(" ");
                    legendList38.setSelectedItem(" ");
            		remarks.setText("");
            		
            		legendList55.setEnabled(false);
                    legendList54.setEnabled(false);
                    legendList53.setEnabled(false);
                    legendList52.setEnabled(false);
                    legendList51.setEnabled(false);
                    legendList61.setEnabled(false);
                    legendList62.setEnabled(false);
                    legendList63.setEnabled(false);
                    legendList64.setEnabled(false);
                    legendList65.setEnabled(false);
                    legendList85.setEnabled(false);
                    legendList84.setEnabled(false);
                    legendList83.setEnabled(false);
                    legendList82.setEnabled(false);
                    legendList81.setEnabled(false);
                    legendList71.setEnabled(false);
                    legendList72.setEnabled(false);
                    legendList73.setEnabled(false);
                    legendList74.setEnabled(false);
                    legendList75.setEnabled(false);
                    legendList18.setEnabled(false);
                    legendList17.setEnabled(false);
                    legendList16.setEnabled(false);
                    legendList15.setEnabled(false);
                    legendList14.setEnabled(false);
                    legendList13.setEnabled(false);
                    legendList12.setEnabled(false);
                    legendList11.setEnabled(false);
                    legendList21.setEnabled(false);
                    legendList22.setEnabled(false);
                    legendList23.setEnabled(false);
                    legendList24.setEnabled(false);
                    legendList25.setEnabled(false);
                    legendList26.setEnabled(false);
                    legendList27.setEnabled(false);
                    legendList28.setEnabled(false);
                    legendList48.setEnabled(false);
                    legendList47.setEnabled(false);
                    legendList46.setEnabled(false);
                    legendList45.setEnabled(false);
                    legendList44.setEnabled(false);
                    legendList43.setEnabled(false);
                    legendList42.setEnabled(false);
                    legendList41.setEnabled(false);
                    legendList31.setEnabled(false);
                    legendList32.setEnabled(false);
                    legendList33.setEnabled(false);
                    legendList34.setEnabled(false);
                    legendList35.setEnabled(false);
                    legendList36.setEnabled(false);
                    legendList37.setEnabled(false);
                    legendList38.setEnabled(false);
                    remarks.setEnabled(false);
                    submit4.setEnabled(false);
                    	
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            }
        });
        
        
        submit4.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	AddOralServicesView aocv = new AddOralServicesView();
            
        		int studentID;
        		String dateOfExam3 = (String)monthOfExam3.getSelectedItem() +" " + (String)dayOfExam3.getSelectedItem()+", "+ yearOfExam3.getText();
            	
        	    String service;
        	    boolean oralProphy = true;
        	    boolean tempFilling= false;
        	    boolean permFilling= false;
        	    boolean sealant= false;
        	    boolean exo= false;
        	    boolean flouride= false;
        	    boolean consultation= false;
        	    boolean other= false;
        	    String remark= remarks.getText();
        	    int ohsid = -1;
            	// Date date = java.util.Calendar.getInstance().getTime();
            	//JComboBox tempLegendList74 = (JComboBox)e.getSource();
                String tooth75status = (String)legendList75.getSelectedItem();
                if(tooth75status.equals("S")) sealant = true;
                else if(tooth75status.equals("PF")) permFilling = true;
                else if(tooth75status.equals("TF")) tempFilling = true;
                else if(tooth75status.equals("X")) exo = true;
                else other = true;
                
                String tooth74status = (String)legendList74.getSelectedItem();
                if(tooth74status.equals("S")) sealant = true;
                else if(tooth74status.equals("PF")) permFilling = true;
                else if(tooth74status.equals("TF")) tempFilling = true;
                else if(tooth74status.equals("X")) exo = true;
                else other = true;
                

                String tooth73status = (String)legendList73.getSelectedItem();
                if(tooth73status.equals("S")) sealant = true;
                else if(tooth73status.equals("PF")) permFilling = true;
                else if(tooth73status.equals("TF")) tempFilling = true;
                else if(tooth73status.equals("X")) exo = true;
                else other = true;
                
                
                String tooth72status = (String)legendList72.getSelectedItem();
                if(tooth72status.equals("S")) sealant = true;
                else if(tooth72status.equals("PF")) permFilling = true;
                else if(tooth72status.equals("TF")) tempFilling = true;
                else if(tooth72status.equals("X")) exo = true;
                else other = true;
                
                String tooth71status = (String)legendList71.getSelectedItem();
                if(tooth71status.equals("S")) sealant = true;
                else if(tooth71status.equals("PF")) permFilling = true;
                else if(tooth71status.equals("TF")) tempFilling = true;
                else if(tooth71status.equals("X")) exo = true;
                else other = true;
                
                
                //updateLabel(petName);
                String tooth85status = (String)legendList85.getSelectedItem();
                if(tooth85status.equals("S")) sealant = true;
                else if(tooth85status.equals("PF")) permFilling = true;
                else if(tooth85status.equals("TF")) tempFilling = true;
                else if(tooth85status.equals("X")) exo = true;
                else other = true;
				
                String tooth84status = (String)legendList84.getSelectedItem();
                if(tooth84status.equals("S")) sealant = true;
                else if(tooth84status.equals("PF")) permFilling = true;
                else if(tooth84status.equals("TF")) tempFilling = true;
                else if(tooth84status.equals("X")) exo = true;
                else other = true;

                String tooth83status = (String)legendList83.getSelectedItem();
                if(tooth83status.equals("S")) sealant = true;
                else if(tooth83status.equals("PF")) permFilling = true;
                else if(tooth83status.equals("TF")) tempFilling = true;
                else if(tooth83status.equals("X")) exo = true;
                else other = true;

                String tooth82status = (String)legendList82.getSelectedItem();
                if(tooth82status.equals("S")) sealant = true;
                else if(tooth82status.equals("PF")) permFilling = true;
                else if(tooth82status.equals("TF")) tempFilling = true;
                else if(tooth82status.equals("X")) exo = true;
                else other = true;

                String tooth81status = (String)legendList81.getSelectedItem();
                if(tooth81status.equals("S")) sealant = true;
                else if(tooth81status.equals("PF")) permFilling = true;
                else if(tooth81status.equals("TF")) tempFilling = true;
                else if(tooth81status.equals("X")) exo = true;
                else other = true;

				
                //label
                String tooth55status = (String)legendList55.getSelectedItem();
                if(tooth55status.equals("S")) sealant = true;
                else if(tooth55status.equals("PF")) permFilling = true;
                else if(tooth55status.equals("TF")) tempFilling = true;
                else if(tooth55status.equals("X")) exo = true;
                else other = true;

                
                String tooth54status = (String)legendList54.getSelectedItem();
                if(tooth54status.equals("S")) sealant = true;
                else if(tooth54status.equals("PF")) permFilling = true;
                else if(tooth54status.equals("TF")) tempFilling = true;
                else if(tooth54status.equals("X")) exo = true;
                else other = true;
				
                String tooth53status = (String)legendList53.getSelectedItem();
                if(tooth53status.equals("S")) sealant = true;
                else if(tooth53status.equals("PF")) permFilling = true;
                else if(tooth53status.equals("TF")) tempFilling = true;
                else if(tooth53status.equals("X")) exo = true;
                else other = true;

                
                String tooth52status = (String)legendList52.getSelectedItem();
                if(tooth52status.equals("S")) sealant = true;
                else if(tooth52status.equals("PF")) permFilling = true;
                else if(tooth52status.equals("TF")) tempFilling = true;
                else if(tooth52status.equals("X")) exo = true;
                else other = true;

				
                String tooth51status = (String)legendList51.getSelectedItem();
                if(tooth51status.equals("S")) sealant = true;
                else if(tooth51status.equals("PF")) permFilling = true;
                else if(tooth51status.equals("TF")) tempFilling = true;
                else if(tooth51status.equals("X")) exo = true;
                else other = true;

				
                //label
                String tooth65status = (String)legendList65.getSelectedItem();
                if(tooth65status.equals("S")) sealant = true;
                else if(tooth65status.equals("PF")) permFilling = true;
                else if(tooth65status.equals("TF")) tempFilling = true;
                else if(tooth65status.equals("X")) exo = true;
                else other = true;

				
                String tooth64status = (String)legendList64.getSelectedItem();
                if(tooth64status.equals("S")) sealant = true;
                else if(tooth64status.equals("PF")) permFilling = true;
                else if(tooth64status.equals("TF")) tempFilling = true;
                else if(tooth64status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth63status = (String)legendList63.getSelectedItem();
                if(tooth63status.equals("S")) sealant = true;
                else if(tooth63status.equals("PF")) permFilling = true;
                else if(tooth63status.equals("TF")) tempFilling = true;
                else if(tooth63status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth62status = (String)legendList62.getSelectedItem();
                if(tooth62status.equals("S")) sealant = true;
                else if(tooth62status.equals("PF")) permFilling = true;
                else if(tooth62status.equals("TF")) tempFilling = true;
                else if(tooth62status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth61status = (String)legendList61.getSelectedItem();
                if(tooth61status.equals("S")) sealant = true;
                else if(tooth61status.equals("PF")) permFilling = true;
                else if(tooth61status.equals("TF")) tempFilling = true;
                else if(tooth61status.equals("X")) exo = true;
                else other = true;
                
				
              //label
                String tooth18status = (String)legendList18.getSelectedItem();
                if(tooth18status.equals("S")) sealant = true;
                else if(tooth18status.equals("PF")) permFilling = true;
                else if(tooth18status.equals("TF")) tempFilling = true;
                else if(tooth18status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth17status = (String)legendList17.getSelectedItem();
                if(tooth17status.equals("S")) sealant = true;
                else if(tooth17status.equals("PF")) permFilling = true;
                else if(tooth17status.equals("TF")) tempFilling = true;
                else if(tooth17status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth16status = (String)legendList16.getSelectedItem();
                if(tooth16status.equals("S")) sealant = true;
                else if(tooth16status.equals("PF")) permFilling = true;
                else if(tooth16status.equals("TF")) tempFilling = true;
                else if(tooth16status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth15status = (String)legendList15.getSelectedItem();
                if(tooth15status.equals("S")) sealant = true;
                else if(tooth15status.equals("PF")) permFilling = true;
                else if(tooth15status.equals("TF")) tempFilling = true;
                else if(tooth15status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth14status = (String)legendList14.getSelectedItem();
                if(tooth14status.equals("S")) sealant = true;
                else if(tooth14status.equals("PF")) permFilling = true;
                else if(tooth14status.equals("TF")) tempFilling = true;
                else if(tooth14status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth13status = (String)legendList13.getSelectedItem();
                if(tooth13status.equals("S")) sealant = true;
                else if(tooth13status.equals("PF")) permFilling = true;
                else if(tooth13status.equals("TF")) tempFilling = true;
                else if(tooth13status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth12status = (String)legendList12.getSelectedItem();
                if(tooth12status.equals("S")) sealant = true;
                else if(tooth12status.equals("PF")) permFilling = true;
                else if(tooth12status.equals("TF")) tempFilling = true;
                else if(tooth12status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth11status = (String)legendList11.getSelectedItem();
                if(tooth11status.equals("S")) sealant = true;
                else if(tooth11status.equals("PF")) permFilling = true;
                else if(tooth11status.equals("TF")) tempFilling = true;
                else if(tooth11status.equals("X")) exo = true;
                else other = true;
                
				
              //label
                String tooth28status = (String)legendList28.getSelectedItem();
                if(tooth28status.equals("S")) sealant = true;
                else if(tooth28status.equals("PF")) permFilling = true;
                else if(tooth28status.equals("TF")) tempFilling = true;
                else if(tooth28status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth27status = (String)legendList27.getSelectedItem();
                if(tooth27status.equals("S")) sealant = true;
                else if(tooth27status.equals("PF")) permFilling = true;
                else if(tooth27status.equals("TF")) tempFilling = true;
                else if(tooth27status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth26status = (String)legendList26.getSelectedItem();
                if(tooth26status.equals("S")) sealant = true;
                else if(tooth26status.equals("PF")) permFilling = true;
                else if(tooth26status.equals("TF")) tempFilling = true;
                else if(tooth26status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth25status = (String)legendList25.getSelectedItem();
                if(tooth25status.equals("S")) sealant = true;
                else if(tooth25status.equals("PF")) permFilling = true;
                else if(tooth25status.equals("TF")) tempFilling = true;
                else if(tooth25status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth24status = (String)legendList24.getSelectedItem();
                if(tooth24status.equals("S")) sealant = true;
                else if(tooth24status.equals("PF")) permFilling = true;
                else if(tooth24status.equals("TF")) tempFilling = true;
                else if(tooth24status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth23status = (String)legendList23.getSelectedItem();
                if(tooth23status.equals("S")) sealant = true;
                else if(tooth23status.equals("PF")) permFilling = true;
                else if(tooth23status.equals("TF")) tempFilling = true;
                else if(tooth23status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth22status = (String)legendList22.getSelectedItem();
                if(tooth22status.equals("S")) sealant = true;
                else if(tooth22status.equals("PF")) permFilling = true;
                else if(tooth22status.equals("TF")) tempFilling = true;
                else if(tooth22status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth21status = (String)legendList21.getSelectedItem();
                if(tooth21status.equals("S")) sealant = true;
                else if(tooth21status.equals("PF")) permFilling = true;
                else if(tooth21status.equals("TF")) tempFilling = true;
                else if(tooth21status.equals("X")) exo = true;
                else other = true;
                
                //label
                String tooth38status = (String)legendList38.getSelectedItem();
                if(tooth38status.equals("S")) sealant = true;
                else if(tooth38status.equals("PF")) permFilling = true;
                else if(tooth38status.equals("TF")) tempFilling = true;
                else if(tooth38status.equals("X")) exo = true;
                else other = true;
                
				
                String tooth37status = (String)legendList37.getSelectedItem();
                if(tooth37status.equals("S")) sealant = true;
                else if(tooth37status.equals("PF")) permFilling = true;
                else if(tooth37status.equals("TF")) tempFilling = true;
                else if(tooth37status.equals("X")) exo = true;
                else other = true;
                
                String tooth36status = (String)legendList36.getSelectedItem();
                if(tooth36status.equals("S")) sealant = true;
                else if(tooth36status.equals("PF")) permFilling = true;
                else if(tooth36status.equals("TF")) tempFilling = true;
                else if(tooth36status.equals("X")) exo = true;
                else other = true;
				
                String tooth35status = (String)legendList35.getSelectedItem();
                if(tooth35status.equals("S")) sealant = true;
                else if(tooth35status.equals("PF")) permFilling = true;
                else if(tooth35status.equals("TF")) tempFilling = true;
                else if(tooth35status.equals("X")) exo = true;
                else other = true;
                
                String tooth34status = (String)legendList34.getSelectedItem();
                if(tooth34status.equals("S")) sealant = true;
                else if(tooth34status.equals("PF")) permFilling = true;
                else if(tooth34status.equals("TF")) tempFilling = true;
                else if(tooth34status.equals("X")) exo = true;
                else other = true;
				
                String tooth33status = (String)legendList33.getSelectedItem();
                if(tooth33status.equals("S")) sealant = true;
                else if(tooth33status.equals("PF")) permFilling = true;
                else if(tooth33status.equals("TF")) tempFilling = true;
                else if(tooth33status.equals("X")) exo = true;
                else other = true;
				
                String tooth32status = (String)legendList32.getSelectedItem();
                if(tooth32status.equals("S")) sealant = true;
                else if(tooth32status.equals("PF")) permFilling = true;
                else if(tooth32status.equals("TF")) tempFilling = true;
                else if(tooth32status.equals("X")) exo = true;
                else other = true;
				
				
                String tooth31status = (String)legendList31.getSelectedItem();
                if(tooth31status.equals("S")) sealant = true;
                else if(tooth31status.equals("PF")) permFilling = true;
                else if(tooth31status.equals("TF")) tempFilling = true;
                else if(tooth31status.equals("X")) exo = true;
                else other = true;
				
                
				//label
                String tooth48status = (String)legendList48.getSelectedItem();
                if(tooth48status.equals("S")) sealant = true;
                else if(tooth48status.equals("PF")) permFilling = true;
                else if(tooth48status.equals("TF")) tempFilling = true;
                else if(tooth48status.equals("X")) exo = true;
                else other = true;
				
                
                String tooth47status = (String)legendList47.getSelectedItem();
                if(tooth47status.equals("S")) sealant = true;
                else if(tooth47status.equals("PF")) permFilling = true;
                else if(tooth47status.equals("TF")) tempFilling = true;
                else if(tooth47status.equals("X")) exo = true;
                else other = true;
				                
                String tooth46status = (String)legendList46.getSelectedItem();
                if(tooth46status.equals("S")) sealant = true;
                else if(tooth46status.equals("PF")) permFilling = true;
                else if(tooth46status.equals("TF")) tempFilling = true;
                else if(tooth46status.equals("X")) exo = true;
                else other = true;
				
                
                String tooth45status = (String)legendList45.getSelectedItem();
                if(tooth45status.equals("S")) sealant = true;
                else if(tooth45status.equals("PF")) permFilling = true;
                else if(tooth45status.equals("TF")) tempFilling = true;
                else if(tooth45status.equals("X")) exo = true;
                else other = true;
				
                
                String tooth44status = (String)legendList44.getSelectedItem();
                if(tooth44status.equals("S")) sealant = true;
                else if(tooth44status.equals("PF")) permFilling = true;
                else if(tooth44status.equals("TF")) tempFilling = true;
                else if(tooth44status.equals("X")) exo = true;
                else other = true;
				
                
                String tooth43status = (String)legendList43.getSelectedItem();
                if(tooth43status.equals("S")) sealant = true;
                else if(tooth43status.equals("PF")) permFilling = true;
                else if(tooth43status.equals("TF")) tempFilling = true;
                else if(tooth43status.equals("X")) exo = true;
                else other = true;
				
                
                String tooth42status = (String)legendList42.getSelectedItem();
                if(tooth42status.equals("S")) sealant = true;
                else if(tooth42status.equals("PF")) permFilling = true;
                else if(tooth42status.equals("TF")) tempFilling = true;
                else if(tooth42status.equals("X")) exo = true;
                else other = true;
				
                
                String tooth41status = (String)legendList41.getSelectedItem();
                if(tooth41status.equals("S")) sealant = true;
                else if(tooth41status.equals("PF")) permFilling = true;
                else if(tooth41status.equals("TF")) tempFilling = true;
                else if(tooth41status.equals("X")) exo = true;
                else other = true;
				
               // dateOfExam3 = (String)monthOfExam3.getSelectedItem() +" " + (String)dayOfExam3.getSelectedItem()+", "+ yearOfExam3.getText();
                
                try {
				ohsid =	aocv.sendAddOralServicesRequest(ohs.getStudentID(),dateOfExam3, 
							oralProphy,tempFilling,permFilling,sealant,
							exo,flouride,consultation,other,remark);
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
            
				ToothPeer.addToothService(ohsid, 75,tooth75status);
				ToothPeer.addToothService(ohsid, 74,tooth74status);
				ToothPeer.addToothService(ohsid, 73,tooth73status);
				ToothPeer.addToothService(ohsid, 72,tooth72status);
				ToothPeer.addToothService(ohsid, 71,tooth71status);
            
				ToothPeer.addToothService(ohsid, 85,tooth85status);
				ToothPeer.addToothService(ohsid, 84,tooth84status);
				ToothPeer.addToothService(ohsid, 83,tooth83status);
				ToothPeer.addToothService(ohsid, 82,tooth82status);
				ToothPeer.addToothService(ohsid, 81,tooth81status);
				
				ToothPeer.addToothService(ohsid, 65,tooth65status);
				ToothPeer.addToothService(ohsid, 64,tooth64status);
				ToothPeer.addToothService(ohsid, 63,tooth63status);
				ToothPeer.addToothService(ohsid, 62,tooth62status);
				ToothPeer.addToothService(ohsid, 61,tooth61status);
				
				ToothPeer.addToothService(ohsid, 55,tooth75status);
				ToothPeer.addToothService(ohsid, 54,tooth74status);
				ToothPeer.addToothService(ohsid, 53,tooth73status);
				ToothPeer.addToothService(ohsid, 52,tooth72status);
				ToothPeer.addToothService(ohsid, 51,tooth71status);
            
				ToothPeer.addToothService(ohsid, 11,tooth11status);
				ToothPeer.addToothService(ohsid, 12,tooth12status);
				ToothPeer.addToothService(ohsid, 13,tooth13status);
				ToothPeer.addToothService(ohsid, 14,tooth14status);
				ToothPeer.addToothService(ohsid, 15,tooth15status);
				ToothPeer.addToothService(ohsid, 16,tooth16status);
				ToothPeer.addToothService(ohsid, 17,tooth17status);
				ToothPeer.addToothService(ohsid, 18,tooth18status);

				ToothPeer.addToothService(ohsid, 21,tooth21status);
				ToothPeer.addToothService(ohsid, 22,tooth22status);
				ToothPeer.addToothService(ohsid, 23,tooth23status);
				ToothPeer.addToothService(ohsid, 24,tooth24status);
				ToothPeer.addToothService(ohsid, 25,tooth25status);
				ToothPeer.addToothService(ohsid, 26,tooth26status);
				ToothPeer.addToothService(ohsid, 27,tooth27status);
				ToothPeer.addToothService(ohsid, 28,tooth28status);

				ToothPeer.addToothService(ohsid, 31,tooth31status);
				ToothPeer.addToothService(ohsid, 32,tooth32status);
				ToothPeer.addToothService(ohsid, 33,tooth33status);
				ToothPeer.addToothService(ohsid, 34,tooth34status);
				ToothPeer.addToothService(ohsid, 35,tooth35status);
				ToothPeer.addToothService(ohsid, 36,tooth36status);
				ToothPeer.addToothService(ohsid, 37,tooth37status);
				ToothPeer.addToothService(ohsid, 38,tooth38status);

				ToothPeer.addToothService(ohsid, 41,tooth41status);
				ToothPeer.addToothService(ohsid, 42,tooth42status);
				ToothPeer.addToothService(ohsid, 43,tooth43status);
				ToothPeer.addToothService(ohsid, 44,tooth44status);
				ToothPeer.addToothService(ohsid, 45,tooth45status);
				ToothPeer.addToothService(ohsid, 46,tooth46status);
				ToothPeer.addToothService(ohsid, 47,tooth47status);
				ToothPeer.addToothService(ohsid, 48,tooth48status);
				
				surnameSearch4.setText("");
      	      firstNameSearch4.setText("");
      	      midNameSearch4.setText("");
      	        
      	        
      	        monthOfExam3.setSelectedItem("");
      	        monthOfExam3.setEditable(false);
      	        monthOfExam3.setEnabled(false);
      	        dayOfExam3.setSelectedItem("");
      	        dayOfExam3.setEditable(false);
      	        dayOfExam3.setEnabled(false);
      	        yearOfExam3.setText("");
      	        yearOfExam3.setEditable(false);
      	    
      		
      		legendList55.setSelectedItem(" ");
              legendList54.setSelectedItem(" ");
              legendList53.setSelectedItem(" ");
              legendList52.setSelectedItem(" ");
              legendList51.setSelectedItem(" ");
              legendList61.setSelectedItem(" ");
              legendList62.setSelectedItem(" ");
              legendList63.setSelectedItem(" ");
              legendList64.setSelectedItem(" ");
              legendList65.setSelectedItem(" ");
              legendList85.setSelectedItem(" ");
              legendList84.setSelectedItem(" ");
              legendList83.setSelectedItem(" ");
              legendList82.setSelectedItem(" ");
              legendList81.setSelectedItem(" ");
              legendList71.setSelectedItem(" ");
              legendList72.setSelectedItem(" ");
              legendList73.setSelectedItem(" ");
              legendList74.setSelectedItem(" ");
              legendList75.setSelectedItem(" ");
              legendList18.setSelectedItem(" ");
              legendList17.setSelectedItem(" ");
              legendList16.setSelectedItem(" ");
              legendList15.setSelectedItem(" ");
              legendList14.setSelectedItem(" ");
              legendList13.setSelectedItem(" ");
              legendList12.setSelectedItem(" ");
              legendList11.setSelectedItem(" ");
              legendList21.setSelectedItem(" ");
              legendList22.setSelectedItem(" ");
              legendList23.setSelectedItem(" ");
              legendList24.setSelectedItem(" ");
              legendList25.setSelectedItem(" ");
              legendList26.setSelectedItem(" ");
              legendList27.setSelectedItem(" ");
              legendList28.setSelectedItem(" ");
              legendList48.setSelectedItem(" ");
              legendList47.setSelectedItem(" ");
              legendList46.setSelectedItem(" ");
              legendList45.setSelectedItem(" ");
              legendList44.setSelectedItem(" ");
              legendList43.setSelectedItem(" ");
              legendList42.setSelectedItem(" ");
              legendList41.setSelectedItem(" ");
              legendList31.setSelectedItem(" ");
              legendList32.setSelectedItem(" ");
              legendList33.setSelectedItem(" ");
              legendList34.setSelectedItem(" ");
              legendList35.setSelectedItem(" ");
              legendList36.setSelectedItem(" ");
              legendList37.setSelectedItem(" ");
              legendList38.setSelectedItem(" ");
      		remarks.setText("");
      		
      		legendList55.setEnabled(false);
              legendList54.setEnabled(false);
              legendList53.setEnabled(false);
              legendList52.setEnabled(false);
              legendList51.setEnabled(false);
              legendList61.setEnabled(false);
              legendList62.setEnabled(false);
              legendList63.setEnabled(false);
              legendList64.setEnabled(false);
              legendList65.setEnabled(false);
              legendList85.setEnabled(false);
              legendList84.setEnabled(false);
              legendList83.setEnabled(false);
              legendList82.setEnabled(false);
              legendList81.setEnabled(false);
              legendList71.setEnabled(false);
              legendList72.setEnabled(false);
              legendList73.setEnabled(false);
              legendList74.setEnabled(false);
              legendList75.setEnabled(false);
              legendList18.setEnabled(false);
              legendList17.setEnabled(false);
              legendList16.setEnabled(false);
              legendList15.setEnabled(false);
              legendList14.setEnabled(false);
              legendList13.setEnabled(false);
              legendList12.setEnabled(false);
              legendList11.setEnabled(false);
              legendList21.setEnabled(false);
              legendList22.setEnabled(false);
              legendList23.setEnabled(false);
              legendList24.setEnabled(false);
              legendList25.setEnabled(false);
              legendList26.setEnabled(false);
              legendList27.setEnabled(false);
              legendList28.setEnabled(false);
              legendList48.setEnabled(false);
              legendList47.setEnabled(false);
              legendList46.setEnabled(false);
              legendList45.setEnabled(false);
              legendList44.setEnabled(false);
              legendList43.setEnabled(false);
              legendList42.setEnabled(false);
              legendList41.setEnabled(false);
              legendList31.setEnabled(false);
              legendList32.setEnabled(false);
              legendList33.setEnabled(false);
              legendList34.setEnabled(false);
              legendList35.setEnabled(false);
              legendList36.setEnabled(false);
              legendList37.setEnabled(false);
              legendList38.setEnabled(false);
              remarks.setEnabled(false);
              submit4.setEnabled(false);
              	
	
				
				JOptionPane.showMessageDialog( nullPanel18,"Services Rendered Added Successfully","SUCCESS", 1);
            }
        });
        
 /*-----------------------------------------------------------------------------*/ 
 /*-----------------------------------------------------------------------------*/       
 /*---------------------------text-fields---------------------------------*/        
        final JTextField surnameEditTextField = new JTextField(20);
        surnameEditTextField.setEnabled(false);
        final JTextField firstNameEditTextField = new JTextField(20);
        firstNameEditTextField.setEnabled(false);
        final JTextField midNameEditTextField = new JTextField(3);
        midNameEditTextField.setEnabled(false);
        final JTextField placeOfBirthEdit = new JTextField(57);
        placeOfBirthEdit.setEnabled(false);
        final JTextField ageTextFieldEdit = new JTextField(3);
        ageTextFieldEdit.setEnabled(false);
        final JTextField yearOfBirthEdit = new JTextField(6);
        yearOfBirthEdit.setEnabled(false);
        final JTextField addressEdit = new JTextField(59);
        addressEdit.setEnabled(false);
        final JTextField parentEdit = new JTextField(55);
        parentEdit.setEnabled(false);
        final JTextField occupationEdit = new JTextField(57);
        occupationEdit.setEnabled(false);
        final JTextField medicalHistoryEdit = new JTextField(55);
        medicalHistoryEdit.setEnabled(false);
        
        
        final JComboBox sexComboBoxEdit = new JComboBox(sexSelect);
        sexComboBox.setEditable(false);
        
        final JComboBox sectionEdit = new JComboBox(sectionSelect);
        section.setEditable(false);
        
        final JComboBox gradeEdit = new JComboBox(gradeSelect);
        grade.setEditable(false);
        
        final JComboBox monthOfBirthEdit = new JComboBox(monthSelect);
        monthOfBirth.setEditable(false);
        //gawing spinner
        final JComboBox dayOfBirthEdit = new JComboBox(daySelect);
        dayOfBirth.setEditable(false);
        
   /*-----------------------------labels----------------------------------*/        
        JLabel surnameLabelEdit = new JLabel("Surname : ");
        JLabel firstNameLabelEdit = new JLabel("Firstname : ");
        JLabel midNameLabelEdit = new JLabel("Middle Initial : ");
        JLabel ageLabelEdit = new JLabel("Age : ");
        JLabel sexLabelEdit = new JLabel("Sex : ");
        JLabel dateOfBirthLabelEdit = new JLabel("Date of Birth : ");
        JLabel monthOfBirthLabelEdit = new JLabel("Month : ");
        JLabel dayOfBirthLabelEdit = new JLabel("Day : ");
        JLabel yearOfBirthLabelEdit = new JLabel("Year : ");
        JLabel placeOfBirthLabelEdit = new JLabel("Place of Birth : ");
        JLabel addressLabelEdit = new JLabel("Address : ");
        JLabel parentLabelEdit = new JLabel("Parent/Guardian : ");
        JLabel occupationLabelEdit = new JLabel("Occupation : ");
        JLabel medicalHistoryLabelEdit = new JLabel("Medical History : ");
        JLabel gradeLabelEdit = new JLabel("Grade : ");
        JLabel sectionLabelEdit = new JLabel("Section : ");
        
  /*----------------------------buttons----------------------------------*/        
             
		final JButton submitEdit = new JButton("Submit");
		JButton reset1Edit = new JButton("Reset");
 
  /*------------------------panels for add new student record-------------------------*/
        JPanel nullPanel1Edit = new JPanel();
        final JPanel nullPanel2Edit = new JPanel();
        JPanel nullPanel3Edit = new JPanel();
        JPanel nullPanel4Edit = new JPanel();
        JPanel nullPanel5Edit = new JPanel();
        JPanel nullPanel6Edit = new JPanel();
        JPanel nullPanel7Edit = new JPanel();
        JPanel nullPanel8Edit = new JPanel();
        JPanel nullPane24 = new JPanel();
        JPanel nullPane25 = new JPanel();
        JPanel nullPanel100Edit= new JPanel();
        JPanel editStudentPanel = new JPanel(new GridLayout(20,0));
 
        JPanel namePanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel dateOfBirthPanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel gradePanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel placeOfBirthPanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel addressPanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel parentPanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel occupationPanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel medicalHistoryPanelEdit = new JPanel(new FlowLayout(SwingConstants.CENTER));
        JPanel buttonsPanelEdit = new JPanel(new FlowLayout());
        JPanel searchPanelEdit = new JPanel(new FlowLayout());
        
/*-----------------buttons for add services rendered----------------------*/
        
        JButton searchEdit = new JButton("Search");

/*-----------------text fields for add DMFX condition----------------------*/

        final JTextField surnameSearch5 = new JTextField(20);
        surnameSearch5.addActionListener(this);
                
        final JTextField firstNameSearch5 = new JTextField(20);
        firstNameSearch5.addActionListener(this);
                
        final JTextField midNameSearch5 = new JTextField(3);
        midNameSearch5.addActionListener(this);

/*-----------------labels for add services rendered----------------------*/

        JLabel surnameLabel5 = new JLabel("Surname : ");
        JLabel firstNameLabel5 = new JLabel("First Name : ");
        JLabel midNameLabel5 = new JLabel("MI : ");
                
        editStudentPanel.add(nullPane24);
        searchPanelEdit.add(surnameLabel5);
        searchPanelEdit.add(surnameSearch5);
        searchPanelEdit.add(firstNameLabel5);
        searchPanelEdit.add(firstNameSearch5);
        searchPanelEdit.add(midNameLabel5);
        searchPanelEdit.add(midNameSearch5);
        searchPanelEdit.add(searchEdit);
        editStudentPanel.add(searchPanelEdit);
        //editStudentPanel.add(nullPane25);
   /*----------------------------layouting----------------------------------*/        
               
        namePanelEdit.add(surnameLabelEdit);
        namePanelEdit.add(surnameEditTextField);
        namePanelEdit.add(firstNameLabelEdit);
        namePanelEdit.add(firstNameEditTextField);
        namePanelEdit.add(midNameLabelEdit);
        namePanelEdit.add(midNameEditTextField);
        
        editStudentPanel.add(nullPanel1Edit);
        editStudentPanel.add(namePanelEdit);
        editStudentPanel.add(nullPanel2Edit);
        
        gradePanelEdit.add(gradeLabelEdit);
        gradePanelEdit.add(gradeEdit);
        gradePanelEdit.add(sectionLabelEdit);
        gradePanelEdit.add(sectionEdit);
        gradePanelEdit.add(ageLabelEdit);
        gradePanelEdit.add(ageTextFieldEdit);
        gradePanelEdit.add(sexLabelEdit);
        gradePanelEdit.add(sexComboBoxEdit);
        
        editStudentPanel.add(gradePanelEdit);
        editStudentPanel.add(nullPanel100Edit);
               
        dateOfBirthPanelEdit.add(dateOfBirthLabelEdit);
        dateOfBirthPanelEdit.add(monthOfBirthLabelEdit);
        dateOfBirthPanelEdit.add(monthOfBirthEdit);
        dateOfBirthPanelEdit.add(dayOfBirthLabelEdit);
        dateOfBirthPanelEdit.add(dayOfBirthEdit);
        dateOfBirthPanelEdit.add(yearOfBirthLabelEdit);
        dateOfBirthPanelEdit.add(yearOfBirthEdit);
        
        editStudentPanel.add(dateOfBirthPanelEdit);
        editStudentPanel.add(nullPanel3Edit);

        
        /*
        dateOfBirthPanelEdit.add(dateOfBirthLabelEdit);
        dateOfBirthPanelEdit.add(dateOfBirthEdit);
        dateOfBirthPanelEdit.add(ageLabelEdit);
        dateOfBirthPanelEdit.add(ageTextFieldEdit);
        dateOfBirthPanelEdit.add(sexLabelEdit);
        dateOfBirthPanelEdit.add(sexTextFieldEdit);
        
        editStudentPanel.add(dateOfBirthPanelEdit);
        editStudentPanel.add(nullPanel3Edit);
        */
        placeOfBirthPanelEdit.add(placeOfBirthLabelEdit);
        placeOfBirthPanelEdit.add(placeOfBirthEdit);
        
        editStudentPanel.add(placeOfBirthPanelEdit);
        editStudentPanel.add(nullPanel4Edit);
		
        addressPanelEdit.add(addressLabelEdit);
        addressPanelEdit.add(addressEdit);
        
        editStudentPanel.add(addressPanelEdit);
        editStudentPanel.add(nullPanel5Edit);
		
        parentPanelEdit.add(parentLabelEdit);
        parentPanelEdit.add(parentEdit);
        editStudentPanel.add(parentPanelEdit);
        editStudentPanel.add(nullPanel6Edit);
        
        occupationPanelEdit.add(occupationLabelEdit);
        occupationPanelEdit.add(occupationEdit);
        
        editStudentPanel.add(occupationPanelEdit);
        editStudentPanel.add(nullPanel7Edit);
        
        medicalHistoryPanelEdit.add(medicalHistoryLabelEdit);
        medicalHistoryPanelEdit.add(medicalHistoryEdit);
        
        editStudentPanel.add(medicalHistoryPanelEdit);
        editStudentPanel.add(nullPanel8Edit);
        
        buttonsPanelEdit.add(submitEdit);
        submitEdit.setEnabled(false);
        buttonsPanelEdit.add(reset1Edit);

        editStudentPanel.add(buttonsPanelEdit);

        
        tabbedPane.addTab("Edit", tooth01, editStudentPanel,
                "Click this tab to edit a student record");
        tabbedPane.setMnemonicAt(5, KeyEvent.VK_6);

        
        searchEdit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	
            	
            	String surn = " ";
            	String fNa = " ";
            	String mIn = " ";
            	String surn2 = " ";
            	String fNa2 = " ";
            	String mIn2 = " ";	
            	
            	String surname = surnameSearch5.getText();
              	String firstname = firstNameSearch5.getText();
              	String mi = midNameSearch5.getText();
                SearchView search = new SearchView();
                try {
					me = search.search(surname,firstname,mi);
					try{
	            	surn = me.getSurname();
	            	fNa = me.getFirstname();
	            	mIn = me.getMi();
	            	surn2 = surn.toLowerCase();
	            	fNa2 = fNa.toLowerCase();
	            	mIn2 = mIn.toLowerCase();
	            	surname = surname.toLowerCase();
	              	firstname = firstname.toLowerCase();
	              	mi = mi.toLowerCase();
	            
	                	if((surname.length()==0)||(firstname.length()==0)||(mi.length()==0)){
	                		JOptionPane.showMessageDialog( nullPanel2Edit,"Missing Inputs","ERROR!", 0);	
	                	}
	                	else if (surname.equals(surn2)&&firstname.equals(fNa2)&&mi.equals(mIn2)){
	                		JOptionPane.showMessageDialog( nullPanel2Edit, fNa+ " " + mIn+ " " + surn + " found","Student Found", 1);


					
	          	      surnameEditTextField.setText("");  
	                    firstNameEditTextField.setText("");
	                    midNameEditTextField.setText("");
	                    dayOfBirthEdit.setSelectedItem("");
	                    monthOfBirthEdit.setSelectedItem("");
	                    yearOfBirthEdit.setText("");
	                    placeOfBirthEdit.setText("");
	                  //  ageTextFieldEdit.setText(me.getAge());
	                    sexComboBoxEdit.setSelectedItem("");
	                    addressEdit.setText("");
	                    parentEdit.setText("");
	                    occupationEdit.setText("");
	                    medicalHistoryEdit.setText("");
	                    gradeEdit.setSelectedItem("");
	                    sectionEdit.setSelectedItem("");

	          	      
	              	surnameEditTextField.setEnabled(false);  
	                  firstNameEditTextField.setEnabled(false);
	                  midNameEditTextField.setEnabled(false);
	                  dayOfBirthEdit.setEnabled(false);
	                  monthOfBirthEdit.setEnabled(false);
	                  yearOfBirthEdit.setEnabled(false);
	                  placeOfBirthEdit.setEnabled(false);
	                  ageTextFieldEdit.setEnabled(false);
	                  sexComboBoxEdit.setEnabled(false);
	                  addressEdit.setEnabled(false);
	                  parentEdit.setEnabled(false);
	                  occupationEdit.setEnabled(false);
	                  medicalHistoryEdit.setEnabled(false);
	                  gradeEdit.setEnabled(false);
	                  sectionEdit.setEnabled(false);
	                  submitEdit.setEnabled(false);

					
					
					surnameEditTextField.setEnabled(true);  
	                firstNameEditTextField.setEnabled(true);
	                midNameEditTextField.setEnabled(true);
	                dayOfBirthEdit.setEnabled(true);
	                monthOfBirthEdit.setEnabled(true);
	                yearOfBirthEdit.setEnabled(true);
	                placeOfBirthEdit.setEnabled(true);
	                ageTextFieldEdit.setEnabled(true);
	                sexComboBoxEdit.setEnabled(true);
	                addressEdit.setEnabled(true);
	                parentEdit.setEnabled(true);
	                occupationEdit.setEnabled(true);
	                medicalHistoryEdit.setEnabled(true);
	                gradeEdit.setEnabled(true);
	                sectionEdit.setEnabled(true);
	                submitEdit.setEnabled(true);
	 
					
	            	editchecker = true;
	                surnameEditTextField.setText(me.getSurname());  
	                firstNameEditTextField.setText(me.getFirstname());
	                midNameEditTextField.setText(me.getMi());
	                dayOfBirthEdit.setSelectedItem(me.getBirthdate());
	                monthOfBirthEdit.setSelectedItem(me.getBirthmonth());
	                yearOfBirthEdit.setText(me.getBirthyear());
	                placeOfBirthEdit.setText(me.getBirthplace());
	                int age = me.getAge();
	                String myage = Integer.toString(age);
	              	ageTextFieldEdit.setText(myage);
	                sexComboBoxEdit.setSelectedItem(me.getGender());
	                addressEdit.setText(me.getAddress());
	                parentEdit.setText(me.getParent());
	                occupationEdit.setText(me.getOccupation());
	                medicalHistoryEdit.setText(me.getMedicalhist());
	                gradeEdit.setSelectedItem(me.getGrade());
	                sectionEdit.setSelectedItem(me.getSection());
	                	}	                
					}
					catch(NullPointerException npe){
						JOptionPane.showMessageDialog( nullPanel2Edit,"Missing Inputs","ERROR!", 0);	
	                		
					}
				} catch (IOException e1) {
					JOptionPane.showMessageDialog( nullPanel2Edit,"Missing Inputs","ERROR!", 0);	
                	
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
				            }
        });

        reset1Edit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	try {
    				
  				  surnameSearch5.setText("");
          	      firstNameSearch5.setText("");
          	      midNameSearch5.setText("");

          	      surnameEditTextField.setText("");  
                    firstNameEditTextField.setText("");
                    midNameEditTextField.setText("");
                    dayOfBirthEdit.setSelectedItem("");
                    monthOfBirthEdit.setSelectedItem("");
                    yearOfBirthEdit.setText("");
                    placeOfBirthEdit.setText("");
                  //  ageTextFieldEdit.setText(me.getAge());
                    sexComboBoxEdit.setSelectedItem("");
                    addressEdit.setText("");
                    parentEdit.setText("");
                    occupationEdit.setText("");
                    medicalHistoryEdit.setText("");
                    gradeEdit.setSelectedItem("");
                    sectionEdit.setSelectedItem("");

          	      
              	surnameEditTextField.setEnabled(false);  
                  firstNameEditTextField.setEnabled(false);
                  midNameEditTextField.setEnabled(false);
                  dayOfBirthEdit.setEnabled(false);
                  monthOfBirthEdit.setEnabled(false);
                  yearOfBirthEdit.setEnabled(false);
                  placeOfBirthEdit.setEnabled(false);
                //  ageTextFieldEdit.setText(me.getAge());
                  sexComboBoxEdit.setEnabled(false);
                  addressEdit.setEnabled(false);
                  parentEdit.setEnabled(false);
                  occupationEdit.setEnabled(false);
                  medicalHistoryEdit.setEnabled(false);
                  gradeEdit.setEnabled(false);
                  sectionEdit.setEnabled(false);
                  submitEdit.setEnabled(false);
   
				} catch (Exception e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
               
            }
        });

        
        submitEdit.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	String surname = surnameSearch5.getText();
              	String firstname = firstNameSearch5.getText();
              	String mi = midNameSearch5.getText();
                SearchView search = new SearchView();
                try {
					me = search.search(surname,firstname,mi);
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
				
            	
				String lastname = surnameEditTextField.getText();  
             	String firstnameE = firstNameEditTextField.getText();
             	String miE = midNameEditTextField.getText();
             	String day = (String)dayOfBirthEdit.getSelectedItem();
                String month = (String) monthOfBirthEdit.getSelectedItem();
                String year = yearOfBirthEdit.getText();
                String bplace = placeOfBirthEdit.getText();
                
                String age = ageTextFieldEdit.getText(); //Integer.toString(myage);
                int myage = Integer.parseInt(age);
                //ageTextFieldEdit.setText(age);
                String gender = (String) sexComboBoxEdit.getSelectedItem();
                String address = addressEdit.getText();
                String parent = parentEdit.getText();
                String occupation = occupationEdit.getText();
                String medhist = medicalHistoryEdit.getText();
                String grade = (String) gradeEdit.getSelectedItem();
                String section = (String) sectionEdit.getSelectedItem();
                
                if(editchecker == true) {
        		EditStudentView esv = new EditStudentView();                
        		try {
        			if((lastname.length()>0) &&
        					(firstnameE.length()>0) &&
        					(miE.length()>0) &&
        					(day.length()>0) &&
        					(month.length()>0) &&
        					(year.length()>0) &&
        					(bplace.length()>0) &&
        					(gender.length()>0) &&
        					(address.length()>0) &&
        					(parent.length()>0) &&
        					(occupation.length()>0) &&
        					(medhist.length()>0) &&
        					(grade.length()>0) &&
        					(section.length()>0)){
					esv.sendEditStudentRequest(me,me.getStudentID(),lastname,
					firstnameE,miE,gender,grade,section,month,day,year,bplace,address,parent,
					occupation,medhist,myage);
					
					 surnameSearch5.setText("");
	          	      firstNameSearch5.setText("");
	          	      midNameSearch5.setText("");

	          	      surnameEditTextField.setText("");  
	                    firstNameEditTextField.setText("");
	                    midNameEditTextField.setText("");
	                    dayOfBirthEdit.setSelectedItem("");
	                    monthOfBirthEdit.setSelectedItem("");
	                    yearOfBirthEdit.setText("");
	                    placeOfBirthEdit.setText("");
	                    ageTextFieldEdit.setText("");
	                    sexComboBoxEdit.setSelectedItem("");
	                    addressEdit.setText("");
	                    parentEdit.setText("");
	                    occupationEdit.setText("");
	                    medicalHistoryEdit.setText("");
	                    gradeEdit.setSelectedItem("");
	                    sectionEdit.setSelectedItem("");

	          	      
	              	surnameEditTextField.setEnabled(false);  
	                  firstNameEditTextField.setEnabled(false);
	                  midNameEditTextField.setEnabled(false);
	                  dayOfBirthEdit.setEnabled(false);
	                  monthOfBirthEdit.setEnabled(false);
	                  yearOfBirthEdit.setEnabled(false);
	                  placeOfBirthEdit.setEnabled(false);
	                //  ageTextFieldEdit.setText(me.getAge());
	                  ageTextFieldEdit.setEnabled(false);
	                  sexComboBoxEdit.setEnabled(false);
	                  addressEdit.setEnabled(false);
	                  parentEdit.setEnabled(false);
	                  occupationEdit.setEnabled(false);
	                  medicalHistoryEdit.setEnabled(false);
	                  gradeEdit.setEnabled(false);
	                  sectionEdit.setEnabled(false);
	                  submitEdit.setEnabled(false);
	                  
	                  JOptionPane.showMessageDialog( dayOfBirthEdit, "Edit Student Record Successful ","SUCCESS", 1);
	             	 

        			}
        			else{
        				JOptionPane.showMessageDialog( dayOfBirthEdit, "Missing Some Inputs","Edit Student Record Failed", 0);
        			}
					
				} catch (TorqueException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				} catch (IOException e1) {
					// TODO Auto-generated catch block
					e1.printStackTrace();
				}
                }
                
                else{
                	System.out.print("Invalid Edit");
                	
                }
            }
        });
/*-----------------------------------------------------------------------------*/ 
/*-----------------------------------------------------------------------------*/       
/* Use 2-d array to access it. */
        final JTextArea basicInfo = new JTextArea(37, 37);
        final JTextArea initInfo = new JTextArea("Initial Oral Health Condition", 37, 37);
        final JTextArea DMFXInfo = new JTextArea("DMFX Condition", 37, 37);
        final JTextArea servicesInfo = new JTextArea("Oral Services Rendered", 37, 37);
        final JTextArea viewallInfo = new JTextArea(35, 37);
        final JTextArea viewallInfo2 = new JTextArea(37, 37);
        JPanel viewStudent = new JPanel(new GridLayout(1,2));
        JPanel viewPanel1 = new JPanel(new FlowLayout((SwingConstants.CENTER)));
        JPanel viewPanel2 = new JPanel(new FlowLayout((SwingConstants.CENTER)));
        JPanel viewInfo = new JPanel(new FlowLayout((SwingConstants.CENTER)));
        JPanel viewInit = new JPanel(new FlowLayout((SwingConstants.CENTER)));
        JPanel searchPanel = new JPanel(new GridLayout(20,0));
        JPanel searchPanel21 = new JPanel(new FlowLayout());
        JPanel viewDMFX = new JPanel(new FlowLayout((SwingConstants.CENTER)));
        JPanel viewServices = new JPanel(new FlowLayout((SwingConstants.CENTER)));
        JTabbedPane viewPane = new JTabbedPane();
        JScrollPane scroller = new JScrollPane();
        JPanel viewStudentPanel = new JPanel(new GridLayout(20,0));
        
    

        JLabel surnameView = new JLabel("Surname : ");
        JLabel fnameView = new JLabel("First Name : ");
        JLabel miView = new JLabel("MI : ");
        JLabel getView = new JLabel("Student ID : ");
		JButton viewSearch = new JButton("Search");
		JButton refresh = new JButton("View All Students");
        final JTextField viewSearchs = new JTextField(20);
        final JTextField viewSearchf = new JTextField(20);
        final JTextField viewSearchm = new JTextField(3);
        final JTextField getSearch = new JTextField(3);
        JButton getstud = new JButton("Get Records");
        
        ViewAllStudentsView view = new ViewAllStudentsView();
        StringBuilder joined = new StringBuilder();
        final java.util.List<Student> list = view.sendViewAllStudentsRequest();
        String studentNames[][] = new String[list.size()][12];
       JPanel panel2 = new JPanel(new FlowLayout());
       final JTextField view4 = new JTextField(50);
       JLabel viewl4 = new JLabel("Existing Records");
       //viewPanel1.add(view4);
       //viewPanel1.add(viewl4);
       SearchView ser = new SearchView();
       JList studentList = new JList(studentNames);
        studentList.setSize(450,700);
        studentList.setVisibleRowCount(50);
       studentList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
       // viewPanel2.add(viewInfo);
        viewallInfo.setSize(450,700);
        viewPanel1.add(new JScrollPane(viewallInfo));
        viewallInfo.setEditable(false);
        
        //for(int j = 0;j < list.size(); j++) {	
        //			viewallInfo.append(list.get(j)+"\n");
        //}
        
       // viewallInfo.setText(wee
       // 		);
        
        
        
        
        viewPane.setSize(450,450);
        /*---------------------*/

        searchPanel.add(surnameView);
        searchPanel.add(viewSearchs);
        searchPanel.add(fnameView);
        searchPanel.add(viewSearchf);
        searchPanel.add(miView);
        searchPanel.add(viewSearchm);
        
        searchPanel.add(viewSearch);
        searchPanel.add(getView);
        searchPanel.add(getSearch);
        searchPanel.add(getstud);
        
        
        viewPanel2.add(viewPane);
        viewPanel2.add(searchPanel);
        searchPanel.setSize(450,700);
        viewPane.add(new JScrollPane(searchPanel));
       viewPane.add(searchPanel);
        viewPane.addTab("Search", null, searchPanel,
        "Click this tab to view all or a particular student");
                
                viewPanel2.add(viewInfo);
                viewInfo.setSize(450,700);
                viewInfo.add(new JScrollPane(basicInfo));
                basicInfo.setEditable(false);
                basicInfo.setText("Name: " +"\n"+
                				  "Grade: " +"\n"+
                				  "Section: "+"\n"+
                				  "Date of Birth: " +"\n"+
                				  "Age: "+"\n"+
                				  "Sex: "+"\n"+
                				  "Place of Birth" +"\n"+
                				  "Address"+"\n"+
                				  "Parent/Guardian: "+"\n"+
                				  "Occupation: "+"\n"+
                				  "Medical History: ");
                
                viewPane.addTab("Basic Info", null, viewInfo,
                "Click this tab to view all or a particular student");
                
                
        viewPanel2.add(viewInit);
        viewInit.setSize(450,700);
        viewInit.add(new JScrollPane(initInfo));
        initInfo.setEditable(false);
        viewPane.addTab("Initial Oral Health", null, viewInit,
        "Click this tab to view all or a particular student");
        
        viewPanel2.add(viewDMFX);
        viewDMFX.setSize(450,700);
        viewDMFX.add(new JScrollPane(DMFXInfo));
        DMFXInfo.setEditable(false);
        viewPane.addTab("DMFX", null, viewDMFX,
        "Click this tab to view all or a particular student");
        
        viewPanel2.add(viewServices);
        viewServices.setSize(450,700);
        viewServices.add(new JScrollPane(servicesInfo));
        servicesInfo.setEditable(false);
        viewPane.addTab("Services", null, viewServices,
        "Click this tab to view all or a particular student");
        viewPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
        
        /*---------------------*/
        
        viewStudent.add(viewPanel2);
  
        tabbedPane.addTab("View", tooth01, viewStudent,
        "Click this tab to view all or a particular student");
        tabbedPane.setMnemonicAt(6, KeyEvent.VK_7);

        //Add the tabbed pane to this panel.
        add(tabbedPane);

        //The following line enables to use scrolling tabs.
        tabbedPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT);
    
        viewStudent.setLayout(new GridLayout(1,1));
        viewPanel1.add(new JScrollPane(viewallInfo));
       //setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
        viewPanel1.add(refresh);
        viewStudent.add(viewPanel1);
        viewStudent.add(viewPanel1);
        
        
        getstud.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	
            	//final java.util.List<Student> list = refreshview.sendViewAllStudentsRequest();
            	String studid = getSearch.getText();
            	int id = Integer.parseInt(studid);
            	me = StudentPeer.getUser(id);    		
            	
                	initInfo.setText("Initial Oral Health Condition"+"\n");
                	DMFXInfo.setText("DMFX Health Condition"+"\n");
                	servicesInfo.setText("Oral Health Services Rendered."+"\n");
                    
                	
                		String surname = viewSearchs.getText();
                      	String firstname = viewSearchf.getText();
                      	String mi = viewSearchm.getText();
                       List<Student> meme = new ArrayList();
                       List<Total> toothtotal = new ArrayList();
                      	SearchAStudentView search = new SearchAStudentView();
                        SearchView sear = new SearchView();
                      	try {
                      		//me = sear.search(surname,firstname,mi);
                      		 meme = search.sendSearchAStudentRequest(surname,firstname,mi);
                      		 
                      		 
                      	} catch (IOException e1) {
        					// TODO Auto-generated catch block
        					e1.printStackTrace();
        				}	
                      	
                      	if(meme != null){
                      		viewallInfo.setText("");
                      		for(int j = 0;j < meme.size(); j++) {
                        		
                    			viewallInfo.append(meme.get(j)+"\n");
                        	}	
                      	}
        				 if(me != null ){                   
        				basicInfo.setText("Name: " +me.getSurname()+me.getFirstname()+me.getMi()+"\n"+
              				  "Grade: " +me.getGrade()+"\n"+
              				  "Section: "+me.getSection()+"\n"+
              				  "Date of Birth: " +me.getBirthmonth()+"  "+me.getBirthdate()+","+me.getBirthyear()+"\n"+
              				  "Age: "+me.getAge()+"\n"+
              				  "Sex: "+me.getGender()+"\n"+
              				  "Place of Birth: "+me.getBirthplace() +"\n"+
              				  "Address: "+me.getAddress()+"\n"+
              				  "Parent/Guardian: "+me.getParent()+"\n"+
              				  "Occupation: "+me.getOccupation()+"\n"+
              				  "Medical History: "+me.getMedicalhist()+"\n\n\nTeeth Summary\n\n\n");
        				toothtotal = TotalPeer.getSummary(me.getStudentID());
        				
        				for(int j = 0;j < toothtotal.size(); j++) {
        					
                			basicInfo.append(toothtotal.get(j)+"\n");
                    	}	
                    
                
        	ViewInitialConditionController vicc = new ViewInitialConditionController();
        	
        	ViewDMFXConditionController vdcc = new ViewDMFXConditionController();
        	
        	ViewOralHealthServicesController vohsc = new ViewOralHealthServicesController();
        	ViewAStudentView vasv = new ViewAStudentView();
    		 //ihc = new ArrayList<InitialHealthCond>();
    		 List<InitialHealthCond> ihc = vasv.requestViewInitialCond(me.getStudentID());
    		//vasv.displayInitialCondition(ihc);
    		
    		//DMFX Condition
    		// dc = new ArrayList<DmfxCond>();
    		List<DmfxCond> dc = vasv.requestViewDMFXCondition(me.getStudentID());
    		//vasv.displayDMFXCondition(dc);
    		
    		//Oral Health Services Rendered
    		// ohs = new ArrayList<OralHealthService>();
    		List<OralHealthService> ohs=vasv.requestViewOralHealthServices(me.getStudentID());
    		
    		try {
    			vasv.displayOralHealthServices(ohs);
    		} catch (TorqueException e1) {
    			// TODO Auto-generated catch block
    			e1.printStackTrace();
    		}
    		
    for(int j = 0;j < ihc.size(); j++) {
            	
            	
            			initInfo.append("Date of Oral Examination: " + ihc.get(j).getDateOfExam()+"\n"
            			+"Dental Caries: " + ihc.get(j).getDentalCarries()+"\n"
            			+"Gingivitis Periodental Diseases: " + ihc.get(j).getGingivitis()+"\n"
            			+"Debris: " + ihc.get(j).getDebris()+"\n"
            			+"Calculus: " + ihc.get(j).getCalculus()+"\n"
            			+"Abnormal Growth: " + ihc.get(j).getAbnormalGrowth()+"\n"
            			+"Cleft Lip/Palate: " + ihc.get(j).getCleftLip()+"\n"
            			+"Others (supernumerary/mesiodens,etc): " + ihc.get(j).getOther()
            			+"\n");
            
          		}

    				for(int j = 0;j < dc.size(); j++) {
    	
    	
    						DMFXInfo.append("\n"
    								+ dc.get(j)+"\n");

    					}

    				for(int j = 0;j < ohs.size(); j++) {
    	
    	
    				servicesInfo.append("\n"
    				+ ohs.get(j)+"\n");

    				}
    				
    				 JOptionPane.showMessageDialog( dayOfBirthEdit, "Student Found.  ","SUCCESS", 1);
       }
        			else {
        					 JOptionPane.showMessageDialog( dayOfBirthEdit, "Student Not Found ","Failure", 1); 
        				 }
        				 
                }

            }
        );

        
        refresh.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	ViewAllStudentsView refreshview = new ViewAllStudentsView();
            	 java.util.List<Student> list = refreshview.sendViewAllStudentsRequest();
            	
            	ViewAllStudentsView refreshview2 = new ViewAllStudentsView();
            	final java.util.List<Student> list2 = refreshview2.sendViewAllStudentsRequest();
            	//JButton testButton = new JButton(list2.get(0));
            	//searchPanel.add(testButton);
            	
            	viewallInfo.setText("");
            	viewallInfo.setText("Existing Records\n\n");
            	for(int j = 0;j < list.size(); j++) {
            		viewallInfo.append(list.get(j)+"\n");
            	}
            	for(int k = 0;k < list2.size(); k++) {
            		String[] names = new String[list2.size()];
            		
            		names[k] = (list2.get(k).getSurname());
            		viewallInfo2.append(names[k]+"\n");
            		
            	}
            	
            }
        });
        viewSearch.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            	initInfo.setText("Initial Oral Health Condition"+"\n");
            	DMFXInfo.setText("DMFX Health Condition"+"\n");
            	servicesInfo.setText("Oral Health Services Rendered."+"\n");
                
            	
            		String surname = viewSearchs.getText();
                  	String firstname = viewSearchf.getText();
                  	String mi = viewSearchm.getText();
                   List<Student> meme = new ArrayList();
                  	SearchAStudentView search = new SearchAStudentView();
                    SearchView sear = new SearchView();
                  	try {
                  		//me = sear.search(surname,firstname,mi);
                  		 meme = search.sendSearchAStudentRequest(surname,firstname,mi);
                  		 
                  		 
                  	} catch (IOException e1) {
    					// TODO Auto-generated catch block
    					e1.printStackTrace();
    				}	
                  	
                  	if(meme != null){
                  		viewallInfo.setText("");
                  		for(int j = 0;j < meme.size(); j++) {
                    		
                			viewallInfo.append(meme.get(j)+"\n");
                    	}	
                  	}
    				 if(me != null ){                   
    				basicInfo.setText("Name: " +me.getSurname()+me.getFirstname()+me.getMi()+"\n"+
          				  "Grade: " +me.getGrade()+"\n"+
          				  "Section: "+me.getSection()+"\n"+
          				  "Date of Birth: " +me.getBirthmonth()+"  "+me.getBirthdate()+","+me.getBirthyear()+"\n"+
          				  "Age: "+me.getAge()+"\n"+
          				  "Sex: "+me.getGender()+"\n"+
          				  "Place of Birth: "+me.getBirthplace() +"\n"+
          				  "Address: "+me.getAddress()+"\n"+
          				  "Parent/Guardian: "+me.getParent()+"\n"+
          				  "Occupation: "+me.getOccupation()+"\n"+
          				  "Medical History: "+me.getMedicalhist());
          
                
            
    	ViewInitialConditionController vicc = new ViewInitialConditionController();
    	
    	ViewDMFXConditionController vdcc = new ViewDMFXConditionController();
    	
    	ViewOralHealthServicesController vohsc = new ViewOralHealthServicesController();
    	ViewAStudentView vasv = new ViewAStudentView();
		 //ihc = new ArrayList<InitialHealthCond>();
		 List<InitialHealthCond> ihc = vasv.requestViewInitialCond(me.getStudentID());
		//vasv.displayInitialCondition(ihc);
		
		//DMFX Condition
		// dc = new ArrayList<DmfxCond>();
		List<DmfxCond> dc = vasv.requestViewDMFXCondition(me.getStudentID());
		//vasv.displayDMFXCondition(dc);
		
		//Oral Health Services Rendered
		// ohs = new ArrayList<OralHealthService>();
		List<OralHealthService> ohs=vasv.requestViewOralHealthServices(me.getStudentID());
		
		try {
			vasv.displayOralHealthServices(ohs);
		} catch (TorqueException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
		
for(int j = 0;j < ihc.size(); j++) {
        	
        	
        			initInfo.append("Date of Oral Examination: " + ihc.get(j).getDateOfExam()+"\n"
        			+"Dental Caries: " + ihc.get(j).getDentalCarries()+"\n"
        			+"Gingivitis Periodental Diseases: " + ihc.get(j).getGingivitis()+"\n"
        			+"Debris: " + ihc.get(j).getDebris()+"\n"
        			+"Calculus: " + ihc.get(j).getCalculus()+"\n"
        			+"Abnormal Growth: " + ihc.get(j).getAbnormalGrowth()+"\n"
        			+"Cleft Lip/Palate: " + ihc.get(j).getCleftLip()+"\n"
        			+"Others (supernumerary/mesiodens,etc): " + ihc.get(j).getOther()
        			+"\n");
        
      		}

				for(int j = 0;j < dc.size(); j++) {
	
	
						DMFXInfo.append("\n"
								+ dc.get(j)+"\n");

					}

				for(int j = 0;j < ohs.size(); j++) {
	
	
				servicesInfo.append("\n"
				+ ohs.get(j)+"\n");

				}
				
				 JOptionPane.showMessageDialog( dayOfBirthEdit, "Student Found. Records are now loaded and ready for viewing. ","SUCCESS", 1);
   }
    			else {
    					 JOptionPane.showMessageDialog( dayOfBirthEdit, "Student Not Found ","Failure", 1); 
    				 }
    				 
            }
        });

    }
        
    /**
     * Create the GUI and show it.  For thread safety,
     * this method should be invoked from
     * the event dispatch thread.
     */
    private static void createAndShowGUI() {
        //Create and set up the window.
        JFrame frame = new JFrame("Cupang Elementary School Dental Records System");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        Toolkit kit = Toolkit.getDefaultToolkit();
		Dimension screenSize = kit.getScreenSize();
		
		int screenHeight = screenSize.height;
		int screenWidth = screenSize.width;
		
		// center frame in screen
		
		        
        //Add content to the window.
        frame.add(new MyInterface (), BorderLayout.CENTER);
        
        //Display the window.
        frame.pack();
      //frame.setSize(screenWidth / 2, screenHeight / 2);
        frame.setLocation(screenWidth/7, screenHeight/20);
        frame.setSize(1000,700);
        frame.setResizable(false);
        frame.setVisible(true);
    }
    
    public static void main(String[] args) {
        //Schedule a job for the event dispatch thread:
        //creating and showing this application's GUI.
        InitTorque it = new InitTorque();
		it.init(); 
		
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                //Turn off metal's use of bold fonts
		UIManager.put("swing.boldMetal", Boolean.FALSE);
		createAndShowGUI();
            }
        });
    }

	@Override
	public void actionPerformed(ActionEvent arg0) {
		// TODO Auto-generated method stub
		
	}


}

